PHPackages                             sadiqsalau/laravel-otp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sadiqsalau/laravel-otp

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

sadiqsalau/laravel-otp
======================

OTP Package for Laravel

v1.0.7(11mo ago)1825.3k↓17.5%31MITPHPPHP ^8.0

Since Mar 12Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/sadiqsalau/laravel-otp)[ Packagist](https://packagist.org/packages/sadiqsalau/laravel-otp)[ RSS](/packages/sadiqsalau-laravel-otp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (1)

Laravel OTP
===========

[](#laravel-otp)

Introduction
------------

[](#introduction)

OTP Package for Laravel using class based system. Every Otp is a class that does something. For example, an `EmailVerificationOtp` which will mark the account as verified.

Installation
------------

[](#installation)

Install via composer

```
composer require sadiqsalau/laravel-otp
```

Publish config file

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

Usage
-----

[](#usage)

### Generate OTP

[](#generate-otp)

```
php artisan make:otp {name}
```

A new Otp class will be generated into the `app/Otp` directory. e.g

```
php artisan make:otp UserRegistrationOtp
```

Every Otp must implement the `process` method which will be called after verification. There the Otp can perform the necessary action and return any result.

```
