承接 codezero/session 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

codezero/session

最新稳定版本:1.0.0

Composer 安装命令:

composer require codezero/session

包简介

Manage session data.

README 文档

README

GitHub release License Build Status Scrutinizer Total Downloads

Manage session data.

This package includes an adapter for Laravel's Session Store, to enable the use of other implementations in non-Laravel projects.

Installation

Install this package through Composer:

composer require codezero/session

Vanilla PHP Implementation

Autoload the vendor classes:

require_once 'vendor/autoload.php'; // Path may vary

And then use the VanillaSession implementation:

$session = new \CodeZero\Session\VanillaSession();

Laravel 5 Implementation

Add a reference to LaravelSessionServiceProvider to the providers array in config/app.php:

'providers' => [
    'CodeZero\Session\LaravelSessionServiceProvider'
]

Then you can "make" (or inject) a Cookie instance anywhere in your app:

$session = \App::make('CodeZero\Session\Session');

TIP: Laravel's IoC container will automatically provide the Laravel specific Session implementation. This will use Laravel's Session goodness behind the scenes!

Usage

Store data in the session

$session->store('key', 'value');
$session->store('key', ['array' => 'value']);

Get session data

If a key doesn't exist, null will be returned.

$array = $session->get(); // An array of all data
$value = $session->get('key'); // Specific data

Delete session data

$session->flush(); // Clear all data
$session->delete('key'); // Clear specific data

Destroy the session

This will flush all data and regenerate the session ID.

$session->destroy();

Testing

$ vendor/bin/phpspec run

Security

If you discover any security related issues, please e-mail me instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Analytics

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-29