I was trying to integrate zend-expressive-session for the AuthSystem . I did integrated the same via constructor injections and not making use of the Middlewares of zend-expressive-session or zend-expressive-session-ext .
I know I am doing against what expressive is doing here. But I am interested to hear your feedback about the same.
This is what it is defined in container.
You can see the ServerRequestInterface , SessionPersistenceInterface is injected to LazySession .
I have a Session middleware
which is similar to the one in
but notable one is LazySession is injected via constructor.
Is there any drawbacks or making use of the same ? Or is there a different approach I can follow here making use of the same Middlewares of zend-expressive-session.
I have also been looking at how @enrico is doing this on zend-expressive-authentication prototype .
I can’t go along the way for the core interface is making use at multiple places .
A session is part of the request scope (in PHP even more specifically so,
due to share-nothing process semantics), so the initial issue (having
session passed in at construct) is a problem on its own. It should be moved
to call-time parameters, or you can move all parameters (including the
request) to the constructor, and make it a request-scoped object.
That said, I don’t understand what you are asking, specifically.
I’ve noted my reservations with using SessionInterface as a service in the pull request you created, and also detailed there a potential solution for your problem that does not require having the session as a service.