snawoot/php-storageless-sessions
Composer 安装命令:
composer require snawoot/php-storageless-sessions
包简介
Storageless sessions with encrypted and HMAC-signed cookies
README 文档
README
Sessions handler which stores session data in HMAC-signed and encrypted cookies.
Requirements
- PHP 5.4.0 or newer
- OpenSSL extension (built-in by default)
- Hash extension (built-in by default)
- Enabled output buffering (
output_buffering=1oroutput_buffering=Onin php.ini)
Usage
Plain PHP
<?php $secret = "reallylongsecretplease"; $handler = new VladislavYarmak\StoragelessSession\CryptoCookieSessionHandler($secret); session_set_save_handler($handler, true); session_start(); $_SESSION["key"] = "value";
Symfony
framework: session: handler_id: session.handler.cookie services: session.handler.cookie: class: VladislavYarmak\StoragelessSession\CryptoCookieSessionHandler public: true arguments: ['reallylongsecretplease']
Handler constructor parameters
CryptoCookieSessionHandler($secret, $expire = 2592000, $digest_algo = "sha256", $cipher_algo = "aes-256-cbc", $cipher_keylen = 32)
$secret- secret passphrase used for HMAC signature and encryption$expire- expiration time of HMAC signature$digest_algo- hash algorithm used for key derivation and cookie signature. Seehash_algos()for all available message digest algorithms.$cipher_algo- cipher algorithm used for session contents encryption. Seeopenssl_get_cipher_methods()for all available ciphers.$cipher_keylen- proper key length for specified cipher algorithm, used for encryption key derivation
snawoot/php-storageless-sessions 适用场景与选型建议
snawoot/php-storageless-sessions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.71k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2017 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cookies」 「sessions」 「hmac」 「encrypted cookies」 「signed cookies」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 snawoot/php-storageless-sessions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 snawoot/php-storageless-sessions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 snawoot/php-storageless-sessions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Pop Session Component for Pop PHP Framework
Eloquent Model for the sessions table as created by artisan session:table
Simple encoding/decoding of data and hash validation using a shared secret
Use Klaro! Consent Manager in Contao CMS
An implementation of a session handler for storing sessions in AWS's DynamoDB, but with no dependencies on the AWS SDK, Guzzle etc
Helper class to easily work with cookies.
统计信息
- 总下载量: 4.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 30
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-30