Download the PHP package codewiser/otp-authenticate without Composer

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

One time passwords for Laravel

In a very simple case, our Laravel applications authenticates users by login and password. Sometimes we force our applications to verify user's emails.

This package requires users to periodically re-verify emails using one time passwords.

The authentication process will be:

Installation

Install service.

Service Provider

Configure the frequency of email re-verification and rate limiters in a service provider class.

Providers/OtpServiceProvider.php

As you can see, we use extended OtpLimit with custom response that returns user back to the previous page with a throttle message.

You may use base Limit as well.

Otp service constructor

OtpService class constructor has one optional parameter. It is a string in date interval format.

For example, if we define new OtpService('P1M'), users will sign in using otp at least once a month.

Empty constructor new OtpService() means that every authentication process accompanied by otp.

Either way, the otp process will be invoked no more often than once during user session.

Otp user contract

Apply MustVerifyEmailWithOtp contract and MustVerifyEmailWithOtp trait to a User model. These contract and trait extends well known MustVerifyEmail.

Models/User.php

Protecting routes

Use EnsureOtpIsPassed middleware to protect only stateful (web) requests.

To protect stateless (api) requests keep using EnsureEmailIsVerified (aka verified) middleware.

routes/web.php

Customization

You may change published blade template, or you may register custom view. You may register custom function to generate otp codes. And you may register custom function for composing a notification.


All versions of otp-authenticate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 codewiser/otp-authenticate contains the following files

Loading the files please wait ...