Send SMS to verify your phone number in laravel.
hizbul/laravel-sms-verification is a Laravel package for send sms to verify your phone number in laravel..
It currently has 24 GitHub stars and 543 downloads on Packagist (latest version v1.2).
Install it with composer require hizbul/laravel-sms-verification.
Discover more Laravel packages by hizbul
or browse all Laravel packages to compare alternatives.
Last updated
This package contains a set of two simple endpoints for doing phone number verification via SMS.
SMS is done via Onnorokom.com API and in fact this code is intended to demonstrate real world use-case for using the Onnorokom.com API. All available Onnorokom.com API's are defined at https://panel.onnorokomsms.com/Content/OnnoRokomSmsWebSeviceAndApiDocumentation.pdf.
Server is written in PHP using the Laravel framework.
Run following command:
composer require hizbul/laravel-sms-verification
Once this library is installed you need to register the service provider. Open config/app.php and find the providers key.
'providers' => [
...
\Hizbul\SmsVerification\SmsVerificationProvider::class,
...
]
Run the command:
php artisan vendor:publish --provider="Hizbul\SmsVerification\SmsVerificationProvider" --tag=config
Add SMS Verification endpoints to your routing file:
\Hizbul\SmsVerification\SmsVerificationProvider::registerRoutes($router);
/sms-verification to send the code to a mobile device/sms-verification/{code}/{mobilePhoneNumber} to verify the codeFor example, if an app wants to send an authorization code to a cell phone 855-123-8765
/sms-verification API to URL https://api.example.com/sms-verification with JSON body {"phone_number" : "+88019194560**"}{"success":true,"description":"OK","expires_at": 1495120612} if the code is sent. expires_at is actual time of code expiration.https://api.example.com/sms-verification/123456/+88019194560**{"success":true,"description":"OK","expires_at": 1495120612}{"success":false,"description":"Wrong code"}If an exception was thrown during the SMS verification process, output contains field error.
1XX - code validation error2XX - something is not configured3XX - input format validation was failed5XX - code generating error4XX - code sending error999 - any other server error, not related to SMS Verification libraryfiles.