Skip to content

alrez96/laravel-otp

Repository files navigation

Laravel OTP - One-Time Password Authentication

Latest Stable Version Total Downloads

Introduction

This is a simple package for implementing the OTP system in Laravel, which only includes generating the token and validating it. You can use this package alongside Laravel's authentication system or the laravel/breeze package.

Installation

You can install the package via composer:

composer require alrez96/laravel-otp

Configuration

You should publish the migration and the config/otp.php config file with:

php artisan vendor:publish --provider="Alrez96\LaravelOtp\OtpServiceProvider"

Usage

Generate OTP Token

<?php

use Alrez96\LaravelOtp\Facades\Otp;

Otp::generateToken(string $identifier);

// or using helper

otp()->generateToken(string $identifier);

Validate OTP Token

<?php

use Alrez96\LaravelOtp\Facades\Otp;

Otp::validateToken(string $identifier, string $token);

// or using helper

otp()->validateToken(string $identifier, string $token);

License

This package is open-sourced software licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages