Generating application key in Lumen

2024-04-24 23:30:23 Satyam Laravel

Lumen generate key

To generate application key in Lumen, please add your routes/web.php and point your domain to /key and copy the output string and paste it in your .env file

$app->get('/key', function() {
    return str_random(32);
});
In Lumen 5.5 or Above
$router->get('/key', function() {
    return str_random(32);
});

Usage:

APP_KEY=Your_Random_String


This post is submitted by one of our members. You may submit a new post here.

Related Tricks