定制 alish/laravel-otp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alish/laravel-otp

Composer 安装命令:

composer require alish/laravel-otp

包简介

My awesome package

README 文档

README

Latest Version on Packagist Build Status Quality Score Total Downloads

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.

统计信息

  • 总下载量: 205
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固