I am building a package that implements native-like sessions in a PSR7 middleware architecture.I created a middleware which is responsible to create and persist a session cookie. The session is also propagated in the request using withAttribute.I want my package to embrace the same philosophy as PSR7, my sessions are immutable in their IDs. If you change the session ID, a new session is created.The problem I am facing is that some other part of the application might want to regenerate the session ID ie after a successful login. How would the middleware know that there is a new session?Here are a few solutions I can think of:Creating a session manager that holds all sessions Leave it be, if there is a new session the other middleware is responsible for itAbstract away from the middleware the persistance code so that it can be reused across middlewares
How to persist a session cookie in a PSR7 request/response middleware?
php;session;http request;http response;middleware