Download the PHP package bryanjhv/slim-session without Composer
On this page you can find all versions of the php package bryanjhv/slim-session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bryanjhv/slim-session
More information about bryanjhv/slim-session
Files in bryanjhv/slim-session
Package slim-session
Short Description Session middleware and helper for Slim framework 4.
License MIT
Homepage https://github.com/bryanjhv/slim-session
Informations about the package slim-session
slim-session
Simple middleware for Slim Framework 4, that allows managing PHP
built-in sessions and includes a Helper
class to help you with the $_SESSION
superglobal.
For the middleware version for Slim Framework 3, please check out the slim-3
branch in this repository.
For the middleware version for Slim Framework 2, please check out the slim-2
branch in this repository.
Installation
Add this line to require
block in your composer.json
:
Or, run in a shell instead:
Usage
Supported options
lifetime
: How much should the session last? Default20 minutes
. Any argument thatstrtotime
can parse is valid.path
,domain
,secure
,httponly
,samesite
: Options for the session cookie. Please note thatsamesite
is'Lax'
by default, set to''
to disable.name
: Name for the session cookie. Defaults toslim_session
(instead of PHP'sPHPSESSID
).autorefresh
:true
if you want session to be refresh when user activity is made (interaction with server).handler
: Custom session handler class or object. Must implementSessionHandlerInterface
as required by PHP.ini_settings
: Associative array of custom session configuration. Previous versions of this package had some hardcoded values which could bring serious performance leaks (see #30):
Session helper
A Helper
class is available, which you can register globally or instantiate:
That will provide $app->get('session')
, so you can do:
Contributors
Here are the big ones listed. :smile:
TODO
- Complete
Helper
tests. (thanks @Zemistr) - Slim-specific tests (integration with Slim App).
License
MIT