Download the PHP package alhaji-aki/laravel-otp-token without Composer

On this page you can find all versions of the php package alhaji-aki/laravel-otp-token. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-otp-token

Laravel Otp Token

This is a simple package to help generate otp tokens for users. This package follows the same approach as laravel's password reset functionality.

Installation

You can install the package via composer by running:

After the installation has completed, the package will automatically register itself. Run the following to publish the migration, config and lang file

After publishing the migration you can create the otp_tokens table by running the migrations:

The contents of the config file looks like:

With this configuration you can have multiple otp token providers just like laravel's password and auth providers.

The lang file that is published looks like:

Usage

The model that u want to generate otp token for should implement the following interface and trait

The getColumnForOtpToken($field) is used the get the value of the field that will be associated to an otp token. This comes in handy if for example you want to be able to generate different otp tokens for say a user's email and mobile phone number during verification.

Generating an otp token

The OtpToken facade exposes a sendOtpToken() method which expects two parameters. They are:

The method returns a response which can be one of the following constants :

A common usage example of the sendOtpToken() is when you want to send an otp verification token to a user's phone number. Here is an example implementation:

The facade also has a performAction() method to perform an action when the provided otp token is valid. This method also expects two parameters. They are:

The method returns a response which can be one of the following constants :

A common usage example of the performAction() is when you want to verify that the otp token is a corrent one. Here is an example implementation:

Testing

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-otp-token with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/contracts Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alhaji-aki/laravel-otp-token contains the following files

Loading the files please wait ....