Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aqlx86/sms-otp
SMS OTP for Laravel 5
https://github.com/aqlx86/sms-otp
isms laravel otp sms
Last synced: 27 days ago
JSON representation
SMS OTP for Laravel 5
- Host: GitHub
- URL: https://github.com/aqlx86/sms-otp
- Owner: aqlx86
- License: mit
- Created: 2017-05-25T08:05:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-30T14:23:14.000Z (over 6 years ago)
- Last Synced: 2024-08-07T23:18:04.903Z (5 months ago)
- Topics: isms, laravel, otp, sms
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction
SMS OTP for Laravel 5. By default this uses iSMS as SMS provider.## Installation
Add sms-otp to your composer.json file:```
composer.phar require "aqlx86/sms-otp"
```Add the service provider to your Laravel application config/app.php:
```PHP
SMSOTP\SMSOTPServiceProvider::class
```## Publish
```
php artisan vendor:publish --provider="SMSOTP\SMSOTPServiceProvider"
php artisan migrate
```## Usage
To send OTP, remember to include `:code` this will be replaced with the actual code.
```
$sender = app()->make(OTPSender::class);
$sender->send('6399512345678', 'holy shit your otp code is :code');
```To verify OTP code
```
$verifier = app()->make(OTPVerifier::class);
$verifier->verify('6399512345678', 'A44E8');
```## Extending
### Using other SMS provider
Create your sms provider
```
class CustomSMSProvider implemnts SMSOTP\Contract\SMSGateway
{
public function send($number, $message)
{
// your implemention
}
}
```Update configuration ```config/smsotp.php```
```
'sms' => CustomSMSProvider::class,
```### Generating your own OTP code
Do the same as creating your own SMS provider.