PHPackages                             albertojm8/laravel-sms-verification - 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. albertojm8/laravel-sms-verification

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

albertojm8/laravel-sms-verification
===================================

Library for sending out and verifying SMS codes using AWS SNS

1.0.2(5y ago)025MITPHP

Since Jun 24Pushed 5y agoCompare

[ Source](https://github.com/albertojm8/laravel-sms-verification)[ Packagist](https://packagist.org/packages/albertojm8/laravel-sms-verification)[ RSS](/packages/albertojm8-laravel-sms-verification/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

laravel-sms-verification
========================

[](#laravel-sms-verification)

Library for sending out and verifying SMS codes using AWS SNS

The package has a trait and a custom validation rule that you can use on any model for verifying with an SMS code.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Example](#example)
- [Sending out the SMS code](#sending-out-the-sms-code)
- [Verifying the SMS code](#verifying-the-sms-code)
- [Setting SMS verification attempt limits](#setting-sms-verification-attempt-limits)
- [Adding custom Validation for verifying an SMS code](#adding-custom-validation-for-verifying-an-sms-code)
- [Adding custom Validation for verifying an SMS code using route model binding](#adding-custom-validation-for-verifying-an-sms-code-using-route-model-binding)
- [Changing the SMS message being sent](#changing-the-sms-message-being-sent)
- [Changing the SMS sender](#changing-the-sms-sender)

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

[](#installation)

Pull the lib with composer:

```
composer require albertojm8/laravel-sms-verification
```

Add the service provider in `config/app.php`

```
Albertojm8\SMSVerification\SMSVerificationServiceProvider::class,
```

You can add SMS Verification to any model, and it will create:

- a function **setSMSVerificationNumber($mobile)** - sets the mobile number and sends out the SMS message containg the verification code
- a function **verifySMSCode($code)** -verifies the SMS code
- and a bunch of private methods that are used for verifying the SMS code. You can check them out in the Trait itself for more details.

Example
-------

[](#example)

Add the `VerifiesSMSCode` trait to your User model (or any other model on which you might want to enable 2FA):

```
