alpha-zeta / session
php session library
1.0.1
2024-09-10 12:51 UTC
Requires
- php: ^8.2
Requires (Dev)
- httpsoft/http-message: ^1.0
- httpsoft/http-response: ^1.0
- httpsoft/http-runner: ^1.0
- httpsoft/http-server-request: ^1.0
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11
This package is auto-updated.
Last update: 2024-11-10 13:18:12 UTC
README
php session library
Install
composer require alpha-zeta/session
Usage
config/container.php
return [ QueryBuilderHandler::class => fn() => (new Connection('mysql', config('database', 'connect.mysql')))->getQueryBuilder(), SessionInterface::class => function (QueryBuilderHandler $qb) { $handler = match (env('SESSION_DRIVER')) { 'DB' => new Driver\Db($qb->pdo()), default => null, }; return new Session(config('session'), $handler); }, ];
then see Az\Session\SessionMiddleware class.
And in anywere:
$this->session->foo = 'bar' $foo = $this->session->foo;
for introduce methods see Az\Session\Session class