polymorphine / session
HTTP Request session context service handled by PSR-15 middleware
0.1.2
2022-10-05 01:42 UTC
Requires
- php: ^7.4 || ^8.0
- polymorphine/headers: 0.1.*
- psr/http-message: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- polymorphine/dev: 0.2.*
This package is auto-updated.
Last update: 2024-11-05 06:05:57 UTC
README
HTTP Request session context service handled by PSR-15 middleware
Installation with Composer
composer require polymorphine/session
How it works?
In procedural code you would have to call session_start()
to allow access to superglobal $_SESSION
array.
This library also requires initialisation phase, but it is achieved with (PSR-15) middleware.
Request going through this middleware will trigger SessionContext
,
and SessionStorage
will become available.
The session storage is not superglobal anymore, and it can be passed explicitly into objects that require access to its data. The downside is that it cannot be instantiated directly before request processing is started, so lazy initialisation is necessary one way or another.