Here's a recap of what needs to be done to activate sessions in Lumen (tested on Lument 5.4):
config/session.php
Download session config from Laravel repo.
bootstrap/app.php
// Load session config (otherwise it won't be loaded)
$app->configure('session');
// Add `Session` middleware
$app->middleware(Illuminate\Session\Middleware\StartSession::class);
// Add `SessionServiceProvider`
$app->register(Illuminate\Session\SessionServiceProvider::class);
// fix `BindingResolutionException` problem
$app->bind(Illuminate\Session\SessionManager::class, function ($app) {
return $app->make('session');
});
After that you can access session with app('session')
in your controller.