jc5/recovery
Composer 安装命令:
composer require jc5/recovery
包简介
Create recovery codes for two factor auth
关键字:
README 文档
README
Generate recovery/backup codes to provide a way for your users to recover from a lost two factor auth, or any problem with it.
Install
Via Composer
$ composer require pragmarx/recovery
Usage
Basic array usage
$this->recovery = new PragmaRX\Recovery(); $this->recovery->toArray();
Collection
If you are using Laravel or install a package like Collect, you can:
$this->recovery->toCollection();
You can also define a different collection function to be used:
$this->recovery->collectionFunction('alternateCollection'); $this->recovery->setCount(8)->toCollection();
Json result
$this->recovery->toJson();
Should give you
[ "C0r2Xp4o1v-oG3pteKXw3", "oLuSmVeJ7D-t4wnJVwkuC", "XdPXXJy3J6-Gl3d0EwWt7", "Bn8twjUJRt-Lv3KaAFwjR", "SrnMagyGRg-eC7WPyFQ17", "mRO4WPJpRN-hgfrUZqqZd", "xBZtyFOrJZ-Tbpg0pSvzf", "eiPFmwvJp0-oSqdNKclDH" ]
Changing the result values/sizes
$this->recovery ->setCount(8) // Generate 8 codes ->setBlocks(5) // Every code must have 7 blocks ->setChars(16) // Each block must have 16 chars ->toArray();
Should give you
[ "0ldZb4vhamHEd8B3-Tmri54Lb0t52wefR-gbJaHTN44O9C1igf-HRdF185SXxDwcdRf", "sFyrtezhjbFhCube-MszCKzvdsNL7QEY1-IY5OtpsFqM5d7jA7-t2mjCViRMHcMDdNZ", "bjKMlcsPhNrpFpSN-IbJR2ebOeXCxXVVb-omZLu3Ki9ImIEqZh-1sK74zOADl86GGRs", "wpa23eFj8PJcPdMG-E8A4LCwmd8iF8jt4-bVi2ltUEv29zoPJJ-pSetq2GD6euvZ9RA", "EJ3SRDQlddr2e2hT-eF79n1lqndwhRM7G-HrjHEVyA9zHSLi8g-TrHzl5oaqPi1NgCT", "lL7p4zjFxhQLND24-MEV1lmmyEKObjhhT-ldRWbOEnJLjBHmuc-Iex10bYAZ3NBljo2", "uomVxkrjGYqOqmdm-AtI9MiqFEJjTlSRi-AUNEwwUfrJVP5iaH-uyrsFCrqzC3WcaAa" ]
Numeric or alpha?
$this->recovery ->numeric() // Generate numeric only codes ->toArray(); $this->recovery ->alpha() // Get back to default alpha generation ->toArray();
Upper, lower and mixed case
$this->recovery ->lowercase() // All lower ->toArray(); $this->recovery ->uppercase() // All upper ->toArray(); $this->recovery ->mixedcase() // Get back to default mixed case ->toArray();
Block separator
Usually - is used as a block separator, but you can change it with:
$this->recovery->setBlockSeparator('|')->toJson();
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer update $ vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email acr@antoniocarlosribeiro.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
jc5/recovery 适用场景与选型建议
jc5/recovery 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 69.08k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 12 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「auth」 「2fa」 「pragmarx」 「google2fa」 「recovery」 「two factor auth」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jc5/recovery 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jc5/recovery 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jc5/recovery 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
This package provides Laravel bindings and a Eloquent/Model trait for pragmarx/recovery package.
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Laravel Server & App Health Monitor and Notifier
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
统计信息
- 总下载量: 69.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-17