alish/laravel-otp
Composer 安装命令:
composer require alish/laravel-otp
包简介
My awesome package
关键字:
README 文档
README
One-Time Password Authentication has gained noticeable popularity amongst software developers, due to its reliablity and ease of use. Using this module, you are able to embedd OTP to your Laravel project in a considerably straightforward manner. This Package is equipped with both Cache and Database drivers to provide developers with the freedom of choice, regarding the unit supposed to hold the OTP and other related information.
Installation
You can install the package via composer:
composer require alish/laravel-otp
Usage
for issuing new token for specific key:
$token = Otp::issue($key = "string");
to revoke token for specific key you can use:
$bool = Otp::revoke($key = 'string'); // return true if a valid provided key revoked
to check token against key:
$bool = Otp::check($key = 'string', $token = 'already issued token'); // if key and token match return true
if you want to use otp generated token (it means check provided key, token then revoke if it matches) you can:
$bool = Otp::use($key = 'string', $token = 'already issued token'); // return true if provided key, token match
Keep in mind that if database driver is your preferred choice, you are supposed to publish migrations file first:
php artisan vendor:publish --provider="Alish\LaravelOtp\OtpServiceProvider" --tag=migrations
then run your migrations with
php artisan migrate
In order to be able to adjust the configuration of this package, you are supposed to publish your configurations using the following command:
php artisan vendor:publish --provider="Alish\LaravelOtp\OtpServiceProvider" --tag=config
-
default: Using this value, you are able to modify the default method to store the OTP and other related information.
-
type: This variable determines the type of the characters included in the OTP. Choices are alpha, alphanumeric, numeric and strong (include special characters).
-
length: By changing this variable, you are able to determine the number of the characters that OTP has.
-
case-sensitive: Using this variable, you are able to control the sensitivity of the package to case sensitivity.
-
custom': Pass the set of the characters you want to create your custom OTPs from as a simple string (eg: "1234") to this variable.
-
timeout: This variable determines the time (in seconds), which the token is active to use. To set a token active permenantly, set timeout to null.
-
hash: Using this variable, you are able to determine if the token should be hashed or not.
-
unique: Using this variable, you are able to revoke all generated tokens after creating a new one, for a specific key. This functionality is only available for Database Driver.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email alishabani9270@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.
alish/laravel-otp 适用场景与选型建议
alish/laravel-otp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 205 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「alish」 「laravel-otp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alish/laravel-otp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alish/laravel-otp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alish/laravel-otp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package provides convenient methods for sending and validating OTP notifications to users for authentication.
Login Otp for Laravel
A package to generate and manage otp
generate and verify otp being sent to users
The OTP package for Laravel.
Authentication Mobile for Laravel
统计信息
- 总下载量: 205
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-10