nigelgreenway/signa
Composer 安装命令:
composer require nigelgreenway/signa
包简介
A framework agnostic token generator
README 文档
README
A framework agnostic token generator built for PHP 7. Uses scalar type hinting and return type hinting.
Will generate a secure token using hash_hmac with access to the value and the expiry date of that token for use within your storage. An insecure token can also be generated with access to just a value, useful for a CSRF token.
Install
Via Composer
$ composer require nigelgreenway/signa
Usage
<?php require __DIR__.'/vendor/autoload.php'; $tokenGenerator = new \Signa\TokenGenerator('s0m3-s3cur3-k3y'); $tokenWithExpiry = $tokenGenerator->tokenWithExpiry( [ 'user_name' => 'Scooby Doo', 'age' => 7, ], new \DateTimeImmutable('+30 Days'), 'sha256' ); // A secure token, for password resets and such echo "A secure token\n"; echo sprintf("Value: %s\n", $tokenWithExpiry->value()); // Some hash string echo sprintf("Expires on: %s\n", $tokenWithExpiry->expiresOn()->format('Y-m-d H:i:s')); // 30 days from today, aka the future // An insecure token, generally CSRF and such echo "\nAn insecure token\n"; $insecureToken = $tokenGenerator->token(36); echo sprintf("Value: %s (Length %d)\n", $insecureToken->value(), strlen($insecureToken->value())); // Some string, 36 char length echo "\nAn insecure token with odd value\n"; $insecureToken = $tokenGenerator->token(33); echo sprintf("Value: %s (Length: %d)\n", $insecureToken->value(), strlen($insecureToken->value())); // Some string, 33 char length
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email github@futurepixels.co.uk instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
nigelgreenway/signa 适用场景与选型建议
nigelgreenway/signa 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.05k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nigelgreenway/signa 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nigelgreenway/signa 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-12