Download the PHP package walkweltech/laravel-otp without Composer

On this page you can find all versions of the php package walkweltech/laravel-otp. 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

Laravel OTP

This is a fork of original because at the point of inception original did not had Laravel 8 Support. Also new features as they come are planned to be added into this fork.

Latest Version on Packagist Build Status StyleCI Quality Score Code Coverage Total Downloads

This package allows you to secure your resources with one time password access (otp).

Example Usage:

Contents

Installation

1- Add the package to your dependencies.

2- Register the package in your config/app.php file:

only if you your auto package discovery off.

3- Publish the components:

Publishes a migration, two views and a configuration file.

4- Apply the migrations:

_Will create a table called otp_tokens to store generated token information._

5- Register the routes:

These routes are required if you are planning to use otp middleware.

In your RouteServiceProvider, append the following line inside the map method:

6- Register the route middleware:

Register the otp route middleware inside your App\Http\Kernel.

Configuration

This package comes with a set of handy configuration options:

password_generator: The password generator option allows you to decide which generator implementation to be used to generate new passwords.

Available built-in options: string, numeric and numeric-no-0. default: string

table: The name of the table to be used to store the otp tokens.

default: otp_tokens

expiry_time: The expiry time of the tokens in minutes.

default: 15

default_channels: The default notification channels of the token notification.

Usage

Basic Usage

After configuring your instance of the package, you can use the built-in otp middleware alias to secure your endpoints:

This middleware will redirect any unauthenticated request to the otp/create endpoint which we have registered in the installation process:

Advanced Usage

Adding the notification channel method:

If you are not using the mail channel, or your notification channel is expecting a method different than mail or sms, you can register your own method like:

Don't forget to change your configuration file as well.

Using your own password generator:

To add your own password generator implemetation, you can call addPasswordGenerator method on Otp service like:

If you need more power, you can also create your own password generator class too:

You can register you password generator like the previous one:

Don't forget to change your configuration file as well.

Determining the otp channel per notifiable

The Notification class checks otpChannels existence inside the notifiable being notified. If so, this method is being called to determine which notification channel is going to be used to notify the notifiable.

Deeper Knowledge:

The public API consists of two main components: OtpService and the Token which generally is being returned by the service.

Otp Service:

If you are planning to create your own API or the basic functionality is not enough four you, you can use the Otp Service API:

Chencking the validity of a given token:
Setting the password generator:
Creating a new token for a given user:
Retrieveing an existing token from the storage by the given plain password:
Retrieveing an existing token from the storage by the given cipher text (token):
Changing the behavior of the Service

The package comes with a ServiceProvider which registers the Otp service to your application's container.

The Otp orchestrates the method calls made to the 3 interface implementations below.

You can write your service provider and register the OtpService with your version of the dependencies.

Note: Because the token class is being used with static calls, you have to send the fully qualified name of your TokenInterface implementation.

Token API:

Getting the attributes of the token:
Invalidate a token:

e.g.

Extend or refresh the token expiry time:

e.g.

Create a new token:

e.g.

Retrieve a token from the storage by the given attributes:

Make sure that the attributes you provided will return a unique token.

e.g.

Convert the token to a notification:

e.g.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Credits

SymfonyInsight


All versions of laravel-otp with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5
illuminate/database Version ^7.0|^8.0
illuminate/http Version ^7.0|^8.0
illuminate/notifications Version ^7.0|^8.0
illuminate/routing Version ^7.0|^8.0
illuminate/support Version ^7.0|^8.0
nesbot/carbon Version ^2.35
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 walkweltech/laravel-otp contains the following files

Loading the files please wait ....