shabayek/laravel-sms is a Laravel package for laravel package for sms sending.
It currently has 2 GitHub stars and 1.060 downloads on Packagist (latest version v1.3.5).
Install it with composer require shabayek/laravel-sms.
Discover more Laravel packages by shabayek
or browse all Laravel packages to compare alternatives.
Last updated
This is a Laravel Package for SMS Gateway Integration. Now Sending SMS is easy.
Via Composer
composer require shabayek/laravel-sms
php artisan vendor:publish --provider="Shabayek\Sms\SmsServiceProvider"
'default' => 'smseg',
SMS_CONNECTION=smseg
SMS_USERNAME=username
SMS_PASSWORD=password
SMS_SENDER_ID=sender
SMS_SERVICE=normal
use Shabayek\Sms\Facades\Sms;
$sms = Sms::send('0120000000', 'Hello world');
if you set sms service normal it's will send via sms message if you set sms service otp it's will send via sms message
use Shabayek\Sms\Facades\Sms;
$sms = Sms::sendOtp('0120000000');
use Shabayek\Sms\Facades\Sms;
$phone = '09121234567'; // phone number
$otp = '123456'; // otp that you sent to phone
$actualOtp = '123456'; // this is the actual otp that you sent to the user
$verify = Sms::verify($phone, $otp, $actualOtp); // third params is optional with service otp
en: For English ar: For Arabic
use Shabayek\Sms\Facades\Sms;
$sms = Sms::setLanguage('ar');
->sendOtp('0120000000');
To create our custom sms driver, we first need to implement the Shabayek\Sms\Contracts\SmsGatewayContract contract. So, a new SMS gateway implementation might look something like this:
namespace Shabayek\Sms\Contracts;
class CustomSms implements SmsGatewayContract
{
public function send($phone, $message): array;
public function sendOtp($phone, $message = null);
public function verify(string $phone, int $otp, $actualOtp = null): bool;
public function balance() { }
}
Then, we need to add a new config for our custom sms driver. in sms config within connections key
'connections' => [
...
'custom' => [
'driver' => 'custom',
'username' => 'username',
'password' => 'password',
'sender_id' => 'sender',
'service' => 'normal',
],
...
],
we can finish our custom driver registration by calling the Sms facade's extend method:
Sms::extend('custom', function ($app) {
return new CustomSms(config());
});
composer test
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
The Laravel SMS Gateway package is open-sourced software licensed under the MIT license.