dogoda / sessions
There is no license information available for the latest version (dev-master) of this package.
A non-blocking session manager
dev-master
2020-11-18 22:43 UTC
Requires
- php: ^5.6|^7.2
- ext-session: *
Requires (Dev)
- duncan3dc/object-intruder: ^0.3.0
- guzzlehttp/guzzle: ^6.3
- mockery/mockery: ^1.0
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^5.7.11
This package is auto-updated.
Last update: 2024-12-19 09:55:54 UTC
README
A non-blocking session handler for PHP
Quick Examples
$session = new \Dogoda\Sessions\SessionInstance("my-app"); $session->set("current-status", 4); $currentStatus = $session->get("current-status"); $session->exists("current-status"); #true
Avoid common key clashes:
$session->set("user", "Mark"); $backend = $session->createNamespace("backend"); $backend->set("user", "Caroline"); $session->get("user"); # "Mark" $backend->get("user"); # "Caroline"
Store one-time flash messages:
$session->setFlash("message", "Your profile has been updated"); $session->getFlash("message"); # "Your profile has been updated"; $session->getFlash("message"); # null;
There is also a static class you can use with all the features above:
use \Dogoda\Sessions\Session; Session::name("my-apps"); Session::set("current-status", 4); $currentStatus = Session::get("current-status"); $session::set("user", "Mark"); $session::exits("user"); #true $session::exits("password"); #false $backend = $session::createNamespace("backend"); $backend::set("user", "Caroline"); $session::get("user"); # "Mark" $backend::get("user"); # "Caroline"
Inspired by duncan3dc/sessions