userfrosting / session
此包已废弃,不再维护。未建议替代包。
基于 illuminate/session 的多种介质存储会话的统一接口
4.5.0
2021-04-21 00:40 UTC
Requires
- php: >=7.1
- illuminate/session: ^5.8
- illuminate/support: ^5.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.13
- phpunit/phpunit: ^7.5 | ^8.5
README
分支 | 构建 | 覆盖率 | 样式 |
---|---|---|---|
master | |||
develop | |
示例用法
use Illuminate\Filesystem\Filesystem;
use Illuminate\Session\FileSessionHandler;
use UserFrosting\Session\Session;
// Use custom filesystem sessions
$fs = new FileSystem;
$handler = new FileSessionHandler($fs, \UserFrosting\APP_DIR . "/sessions");
// Creates a new wrapper for $_SESSION
$session = new Session($handler, $config['session']);
// Starts the session
$session->start();
// Set some values
$session['contacts.housekeeper.name']; = 'Alex "the man" Weissman';
// They're stored in array format...
print_r($session->all());
// Output is:
/*
[
'contacts' => [
'housekeeper' => [
'name' => 'Alex "the man" Weissman'
]
]
];
*/
// Destroy the session, both in memory and on the persistence layer, and tell the browser to remove the cookie
$session->destroy();