PHPackages                             sophat/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. sophat/laravel-otp

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

sophat/laravel-otp
==================

OTP Package for Laravel

71[1 PRs](https://github.com/pphatdev/laravel-otp/pulls)PHPCI failing

Since May 29Pushed 2w ago1 watchersCompare

[ Source](https://github.com/pphatdev/laravel-otp)[ Packagist](https://packagist.org/packages/sophat/laravel-otp)[ RSS](/packages/sophat-laravel-otp/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (8)Used By (0)

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 sophat/laravel-otp
```

Publish config file

```
php artisan vendor:publish --provider="Sophat\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.

```
