Download the PHP package neoflow/session without Composer
On this page you can find all versions of the php package neoflow/session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neoflow/session
More information about neoflow/session
Files in neoflow/session
Package session
Short Description Session service for Slim 4 and similar PSR-15 compliant frameworks and apps.
License MIT
Informations about the package session
This project is no longer maintained.
Please use other solutions for session handling on PHP.
Session
Session service for Slim 4 and similar PSR-15 compliant frameworks and apps.
Table of Contents
- Requirement
- Installation
- Configuration
- Usage
- Flash messages
- Contributors
- History
- License
Requirement
- PHP >= 7.3
Installation
You have 2 options to install this library.
Via composer...
...or manually download the latest release from here.
Configuration
The following instructions based on Slim 4, in combination with PHP-DI, but should be adaptable for any PSR-11/PSR-15 compliant frameworks and libraries.
Add the service Neoflow\Session\Session
and middleware Neoflow\Session\Middleware\SessionMiddleware
to the container definitions...
...and register the middleware, to autostart the session when it got dispatched.
The service Neoflow\Session\Session
supports the following options:
Key | Type | Description | Default |
---|---|---|---|
name |
string | Name of the session cookie. | "sid" |
autoRefresh |
bool | Refresh of session lifetime after each request. | true |
cookie['lifetime'] |
int | Lifetime in seconds of the session cookie in seconds | 3600 |
cookie['path'] |
string | Path to set in the session cookie | "/" |
cookie['domain'] |
string/null | Domain to set in the session cookie | null |
cookie['secure'] |
bool | Set true to sent session cookie only over secure connections |
false |
cookie['httponly'] |
bool | Set false to make session cookie accessible for scripting languages |
true |
cookie['samesite'] |
string | Set "Strict" to prevent the session cookie be sent along with cross-site requests |
"Lax" |
iniSettings[] |
array | PHP session settings, without session. |
[] |
When your DI container supports inflectors (e.g. league/container),
you can optionally register Neoflow/Session/SessionAwareInterface
as inflector to your container definition.
Additionally, you can also use Neoflow/Session/SessionAwareTrait
as a shorthand implementation of
Neoflow/Session/SessionAwareInterface
.
Usage
Examples how to handle the session:
Examples how to access and manage the values of the session:
Flash messages
The first version of this library had built-in support for flash messages. But to comply with the design principle of separation of concerns, the code of the flash messages was move into a standalone library, called Neoflow\FlashMessages.
If you need support for flash messages, you can easily combine both libraries as composer packages. The integration and usage of Neoflow\FlashMessages is very similar to the current library.
Contributors
- Jonathan Nessier, Neoflow
If you would like to see this library develop further, or if you want to support me or show me your appreciation, please donate any amount through PayPal. Thank you! :beers:
License
Licensed under MIT.
Made in Switzerland with :cheese: and :heart: