romeoz/rock-session
最新稳定版本:0.12.0
Composer 安装命令:
composer require romeoz/rock-session
包简介
A simple Session library for PHP
README 文档
README
Handlers
Installation
From the Command Line:
composer require romeoz/rock-session
or in your composer.json:
{
"require": {
"romeoz/rock-session": "*"
}
}
Quick Start
####Session as key-value memory storage
$config = [ 'cache' => new \rock\cache\Memcached ]; $session = new \rock\session\MemorySession($config); $session->add('name', 'Tom'); echo $session->get('name'); // result: Tom
####Session as MongoDB storage
$config = [ 'connection' => new \rock\mongodb\Connection ]; $session = new \rock\session\MongoSession($config); $session->add('name', 'Tom'); echo $session->get('name'); // result: Tom
Default is used the garbage collector (GC). You can use TTL indexes.
$connection = new \rock\mongodb\Connection; // Create TTL index $connection ->getCollection('session') ->createIndex('expire', ['expireAfterSeconds' => 0]); $config = [ 'connection' => $connection, 'useGC' => false ]; $session = new \rock\session\MongoSession($config); $session->add('name', 'Tom'); echo $session->get('name'); // result: Tom
Requirements
- PHP 5.4+
- For
MemorySessionrequired Rock Cache:composer require romeoz/rock-cache - For
MongoSessionrequired Rock MongoDB:composer require romeoz/rock-mongodb - For
DbSessionrequired Rock DB:composer require romeoz/rock-db
All unbolded dependencies is optional.
License
Session library is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 1.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 5
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-15