expressive session middleware
1.0.1
Zend Expressive 的简单会话中间件
通过作曲家
$ composer require damess/expressive-session-middleware
将以下工厂添加到您的容器配置中
return [
' dependencies ' => [
' factories ' => [
DaMess Http SessionMiddleware::class => DaMess Factory SessionMiddlewareFactory::class,
Aura Session Session::class => DaMess Factory AuraSessionFactory::class,
],
],
];
设置预路由中间件。
return [
' middleware_pipeline ' => [
' always ' => [
' middleware ' => [
DaMess Http SessionMiddleware::class,
],
' priority ' => 10000 ,
],
],
];
从请求中获取会话对象
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
*/
public function __invoke ( ServerRequestInterface $ request , ResponseInterface $ response )
{
/**
* @var AuraSessionSession $session
*/
$ session = $ request -> getAttribute ( DaMess Http SessionMiddleware:: KEY );
}
可以通过将以下数据添加到您的配置(即 session.global.php)来配置会话。请参阅 session.global.php.dist
return [
' session ' => [
' name ' => ' PHPSESSID ' ,
' lifetime ' => 7200 ,
' path ' => null ,
' domain ' => null ,
' secure ' => false ,
' httponly ' => true ,
],
];
请参阅变更日志以了解最近更改的更多信息。
$ composer test
有关详细信息,请参阅贡献和行为。
麻省理工学院许可证 (MIT)。请参阅许可证文件以获取更多信息。