emotality/laravel-otp

A Laravel package to send OTP via email & SMS.

v1.1 2022-11-01 11:52 UTC

This package is auto-updated.

Last update: 2024-11-12 08:24:41 UTC


README

Packagist License Latest Stable Version Total Downloads

A Laravel package to send OTP via email & SMS. Specify different models and their columns!

Installation

  1. composer require emotality/laravel-otp
  2. php artisan vendor:publish --provider="Emotality\OTP\OTPServiceProvider"
  3. Configure your config/otp.php file

Usage

Import OTP class:

use Emotality\OTP\OTP;

Send OTP to the user that just logged in:

OTP::email($user);
OTP::sms($user);
OTP::smsOrEmail($user);
OTP::smsAndEmail($user);

If OTP was entered correctly, you can remove OTP from database:

OTP::clear($user);

Providers

License

laravel-otp is released under the MIT license. See LICENSE for details.