Download the PHP package horlerdipo/simple-otp without Composer

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

A Simple OTP Package for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This Laravel package provides a flexible and pluggable One-Time Password (OTP) system, supporting multiple delivery channels like Email and custom drivers.

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

//: # ()

Introduction

Overview

This Laravel package provides a flexible and pluggable One-Time Password (OTP) system, supporting multiple delivery channels like Email and custom drivers. You can get up and running with a full OTP system with just a couple of lines

Features

Requirements

Installation

You can install the package via composer:

You can publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file:

If you would like to use the package email template(you shouldn't 😂), you can publish the views using

Quickstart

Basic Setup

After installation, make sure your .env and config/otp.php are configured correctly, the default channel is Email so OTPs will be sent to emails. You can change the default channel on the config file at runtime as well.

Sending an OTP

Verifying an OTP

The method returns a object that has a which is a boolean that is true if the OTP is correct and false if it is not, the object also has property that contains the reason why the OTP is not correct. If for any reason, you would like the otp not to be used immediately, you can pass as the fourth parameter for the endpoint.

Configuration Overview

You can configure OTP generation using method chaining before calling method

Example

Channel Guide

Email Channel

Overview

Ensure your mail configuration is properly set in the .env. The email template is defined in config/simple-otp.php.

Example Usage

BlackHole Channel

Overview

This channel was created primarily for testing or development. It simulates OTP sending without actually delivering the OTP. It comes with a method that returns the token that was generated, this is useful in a scenario where you would like to send the OTP in some other way the package is not shipped with, and you do not want to create a custom channel for it.

Example Usage

Advanced Usage

Adding Custom Channels

Creating a custom channel class

The custom channel class must implement the and the . You can simply extend the abstract class to get predefined methods to speed up your custom channel development

Registering the channel

The custom service is registered by calling the method in the method of the service provider

Custom Channel Usage

The newly registered channel can now be used by either changing the to or the name added while registering or using it in the channel

Example Channel Implementation

The , and are already implemented in the abstract class, all you need to be concerned about is the method which defines how the OTP will be sent to the user.

Using the Manager Class directly

If you are not a fan of Facades, you can also simply call the underlying class directly like below

You can as well call the Channel classes directly if you even want to go even lower, we currently have the following channels and the classes

Pruning Old OTPs

To avoid the table from getting filled up, you should add the command to your scheduler. This also takes an input of the hours how far back the expired OTP should be, the default is .

Troubleshooting & FAQ

Verify your template paths

Ensure hashing is consistent between send and verify

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of simple-otp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.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 horlerdipo/simple-otp contains the following files

Loading the files please wait ....