I am not sure exactly how you are using what. But you may just want to use Laravel for your needs.
I am not 100% sure, but I think most people use lumen for API's and therefore use token based Auth.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I can't seem to find any way to do sorting of middleware in Lumen. Session auth is being used by the application and the problem is, Authenticate middleware is being called first before StartSession thus resulting in session not behaving properly/not saved.
I know there's SortedMiddleware component but not really sure where to fit that one.
Ideas?
EDIT
Using xdebug to trace the stack, it seems StartSession is called first and then Authenticate next.
After a successful login, Authenticate middleware would fail because it can't get user data from session because it's empty.
Finally figured it out:
@talinon the solution that is found in the link you gave is that, first it tells you to manually register the SessionManager to prevent the unresolvable depedency parameter #0 $app then also register the existing SessionServiceProvider which also binds another instance SessionManager.
Problem with that is, some components use the other instance and other parts use the new one which causes my auth attempt session not being save despite actually being put inside.
I checked around Application.php and saw I can just easily do this in bootstrap/app.php:
$app->singleton(Illuminate\Session\SessionManager::class, function () use ($app) {
return $app->loadComponent('session', Illuminate\Session\SessionServiceProvider::class, 'session');
});
$app->singleton('session.store', function () use ($app) {
return $app->loadComponent('session', Illuminate\Session\SessionServiceProvider::class, 'session.store');
});
The answer in this Stackoverflow question helped a lot in explaining: https://stackoverflow.com/questions/35826585/properly-inject-authmanager/35847704
Please or to participate in this conversation.