Hi all,
I am not a big fan of retrieving dependencies via Request attributes. I believe dependencies should be explicit.
So the big picture :
I have pet project called web.expressive which tries to integrate the dms with zend expressive. ( I don’t think dms was developed in mind for PSR-7 requests, so its api is a bit different. )
It has an IAuthSystem system which is injected to most of the places and controllers ( actions ) . The AuthSystem
needs session to check if the user is logged in or not.
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 .
The code is under session branch .
https://github.com/harikt/web.expressive/tree/session ( package )
https://github.com/harikt/dms-expressive-skeleton/tree/session ( demo )
Thank you for your valuable time.
If you have feedback I am interested to hear.