定制 onesimus-systems/ossession 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

onesimus-systems/ossession

最新稳定版本:1.0.2

Composer 安装命令:

composer require onesimus-systems/ossession

包简介

Centralized session management for PHP applications.

关键字:

README 文档

README

OSSession provides a centralized, database backed PHP session manager. It requires minimal setup and provides a reliable easy way to manage PHP sessions.

Requirements

  • PHP >= 5.4.0

Usage

use \Onesimus\Session\SessionManager

// First we need to register the session handler
$pdo = new PDO(...);
$options = [
	'timeout' => 6 // hours
	'gclotto' => [1, 100] // Chances a garbage collection will occur
	'table' => 'sessions' // Database table that houses the session data. It must have three fields called 'id', 'data', and 'last_accessed'. 'last_accessed' is an int as times are stored in Unix time.
];

SessionManager::register($pdo, $options);
SessionManager::startSession('php-session-name');

// Manipulate session data
SessionManager::set('userid', 2);
SessionManager::get('themename', 'default'); // get will either return the session value if it exists or whatever is passed as the second argument. By default it will return null if the session data doesn't exist.

SessionManager::clear(); // Clear a session

License

OSSession is released under the BSD 3-clause license. The license text can be found in LICENSE.md.

统计信息

  • 总下载量: 87
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-10-11