承接 delfimov/session 相关项目开发

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

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

delfimov/session

Composer 安装命令:

composer require delfimov/session

包简介

Easy to use library for managing PHP built-in sessions

README 文档

README

License

Session

PSR-11 compatible easy to use library for managing PHP built-in sessions. PDO handler included.

Requirements

How to install

Add this line to your composer.json file:

"delfimov/session": "~1.0"

or

composer require delfimov/session

How to configure

The session management system supports a number of configuration options which you can place in your php.ini file or redefine in your code.

The most important settings with recommended values:

session.name = PHPSESSID
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 2592000
; lifetime of sessions = 60*60*24*30 = 30 days
session.use_cookies = 1
session.use_only_cookies = 1
session.cookie_lifetime = 2592000
; same as session lifetime

I highly recommend to use https protocol and marks the cookie as accessible only through the HTTP protocol.

session.cookie_secure = 1
session.cookie_httponly = 1

See PHP Sessions Runtime Configuration for more details.

An example

See example directory for sources.

require_once __DIR__ . '/../vendor/autoload.php';
$session = new DElfimov\Session\Session(
    new DElfimov\Session\Handlers\PDOHandler(
            new \PDO('mysql:dbname=testdb;host=127.0.0.1', 'dbuser', 'dbpass')
    )
);

$session->set('a', 'value a');

try {
    echo $session->get('a');
} catch (\Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

if ($session->has('b')) {
    echo 'Wonder!';
}

$session->remove('a');

TODO

  • Better code coverage
  • Handlers

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固