Hello Amanda,
However, I am speaking as an individual contributor, not speaking as a representative of Horde. That would be Jan Schneider's role.
Looking forward to participate.
Regards
Ralf
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/47aad66e-89cf-4f9a-b536-e925d8324488n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/7e8a2e90-efe7-4900-b7f6-d221fd7b2607%40app.fastmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAKxcST9B5Rp-tK_q4e7-45nhvO1qcyiBVQTqsjhsTTgJqjCVKw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAP2uk-B8tF51QgYMjMkOFYbxzFXR20Bqs_%2BR%3DKP31kKrohygDg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAKxcST9EuECoeoVeHdOK5twgotB7toamvgEchbHj96psw17OxQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/c2f15154-f8bf-439d-95fa-07042955d3c3n%40googlegroups.com.
Hi Amanda,
I'm interested in this, and I mostly agree with your approach and philosophy.
I did some work today trying to move this idea forward, and would propose some changes.
First, I'd like to replace the mutable ServerRequestSessionInterface with an immutable SessionManagerInterface, which would be responsible for:
This seems to be more in tune with PSR-7/15 and makes it obvious how to integrate them.
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; interface SessionManagerInterface { /** * Initiates a new session or resumes an existing session based on the request context. * * @param ServerRequestInterface $request * * @return SessionInterface */ public function open(ServerRequestInterface $request): SessionInterface; /** * Commits session data to storage and applies session cookies to the response. * * @param SessionInterface $session * @param ResponseInterface $response * * @return ResponseInterface */ public function commit(SessionInterface $session, ResponseInterface $response): ResponseInterface; }Secondly, I'd propose some changes to simplify the SessionInterface to clarify its role as the bearer session state (and session identifier) and simplifying its semantics:
To those who commented with "we don't need this", I would disagree - I think there are clear cut use cases for this, starting with stateful handlers or middlewares, in particular things like routers or controller abstractions that need to store state between requests. I think it's a good idea to have a standard way to do this that is compatible with PSR-7/15.
Further more, as Amanda explained, we need this because there is no obvious way to use sessions in a PSR-7/15 context. Using $_SESSION creates serious problems with testing, and PSR standards do not provide any alternative. This is a problem that needs to be solved.
I would point out that a session abstraction doesn't need to cover every imaginable use case - and doesn't need to have full parity with every existing framework or library out there, and and it should not aim to be a replacement for session abstractions in existing frameworks.
Looking at some of the available libraries for session management, interfaces like these should work fine (via adapters) for e.g. all of the following:
These libraries aim to replace $_SESSION with a more testable and flexible alternative, and I think it's important to have an interface that decouples frameworks, middleware, routers, etc. from the implementation - enabling the use of session state without having to depend on a specific library.
Amanda, if you're still interested, I'd be happy to join a working group and help out. :-)