silverstripe/hybridsessions
Composer 安装命令:
composer require silverstripe/hybridsessions
包简介
Cookie/DB session support for SilverStripe
关键字:
README 文档
README
Introduction
Adds a session handler that tries storing the session in an encrypted cookie when possible, and if not ( because the session is too large, or headers have already been set) stores it in the database.
This allows using Silverstripe on multiple servers without sticky sessions (as long as you solve other multi-server issues like asset storage and databases).
Limitations
- MySQL database is the only supported DB store.
Installation
composer require silverstripe/hybridsessions
Setup
sake db:build --flushto setup the necessary tables- In order to initiate the session handler is is necessary to add a snippet of code to your
_config.phpfile, along with a private key used to encrypt user cookies.
in app/src/_config.php:
// Ensure that you define a sufficiently indeterminable value for SS_SESSION_KEY in your `.env` use SilverStripe\Core\Environment; use SilverStripe\HybridSessions\HybridSession; HybridSession::init(Environment::getEnv('SS_SESSION_KEY'));
Security
As long as the key is unguessable and secret, generally this should be as secure as server-side-only cookies. The one exception is that cookie sessions are vulnerable to replay attacks. This is only a problem if you're storing stuff you shouldn't in the session anyway, but it's important you understand the issue. Ruby on rails has good documentation of the issue at http://guides.rubyonrails.org/security.html#replay-attacks-for-cookiestore-sessions
Crypto handlers
This module ships with two default cryptographic handlers:
OpenSSLCrypto: uses the OpenSSL library (default).
You can also implement your own cryptographic handler by creating a class that implements the
SilverStripe\HybridSessions\Crypto\CryptoHandler interface.
To configure the active handler, add YAML configuration to your project:
--- Name: myappsessionstores After: sessionstores --- SilverStripe\HybridSessions\HybridSession: SilverStripe\HybridSessions\Crypto\CryptoHandler: class: MyCustomCryptoHandler
Caveats
This module is not fully compatible with the testsession module, as the database store is not available prior to DB connectivity, which uses the session to dictate DB connections. Data smaller than 1000 bytes may still be stored via the cookie store, but larger data sets will be lost.
silverstripe/hybridsessions 适用场景与选型建议
silverstripe/hybridsessions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 508.9k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2014 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「session」 「silverstripe」 「cwp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 silverstripe/hybridsessions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripe/hybridsessions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 silverstripe/hybridsessions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provide search and export interfaces for datasets.
HTML5 support for SilverStripe
CWP features module. We strongly recommend using it for all new sites. Future features will be delivered here.
Adds RSS feeds of content changes to SilverStripe
Imports OpenOffice-compatible files (doc, docx, etc) into SilverStripe pages and content.
CWP Theme
统计信息
- 总下载量: 508.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 43
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-08-15