php-platform/web-session

v0.1.2 2017-08-13 14:22 UTC

This package is auto-updated.

Last update: 2024-09-21 20:25:55 UTC


README

此包实现了来自 php-platform/session 包的 Web 会话接口

build status coverage report

简介

可以为 Web 应用程序或命令行创建会话。此包实现了 Web 会话

用法

在 [php-platform/session](https://github.com/PHPPlatform/session) 的 config.json 中将 `PhpPlatform\WebSession\Session 配置为 session.class

{
    "session":{
        "class":"PhpPlatform\\WebSession\\Session"
    }
}

配置

盐值

盐值用于加密从实际会话 ID 产生的会话文件名

$sessionFileName = md5($salt.$sessionId);

路径

路径是设置此会话 cookie 的 URI 路径,此值作为 Set-Cookie 的路径参数发送

超时

会话超时时间(秒),此值用于计算 Set-Cookie 的 expires 和 Max-Age 参数

名称

会话名称,这是发送到客户端的 cookie 名称

会话文件前缀

这是此应用程序会话文件名的前缀,由于所有会话文件都存储在相同的目录中,这有助于对每个应用程序的会话文件进行分类

脚本

delete-expired-sessions

要删除已过期的会话文件,请定期运行此脚本(手动或作为 cron 作业)

$ ./vendor/bin/delete-expired-sessions