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)。請參閱許可證文件以獲取更多資訊。