Skip to main content

Laravel SMS

SMS and OTP gateway drivers for Laravel, behind one facade.

composer require shabayek/laravel-sms

One API for every gateway

send(), sendOtp(), verify() and balance() work the same way on SMS EG, SMS Misr, Victory Link and Ooredoo.

OTP built in

Codes are generated with random_int() and checked with hash_equals(). SMS EG can also generate and check the code on the gateway.

Structured results

send() returns a ResponseCode enum, a message you can change in config, and the gateway’s own code and message.

Encoding detection

English, Arabic or Unicode encoding is picked from the message text, so the same code works in any language.

Timeouts and safe errors

Request and connect timeouts are configurable. Transport errors never include credentials, phone numbers or codes.

Custom drivers

Add your own gateway with Sms::extend(), or turn sending off in local and test environments with the null driver.

Send a message

use Shabayek\Sms\Facade\Sms;

$result = Sms::send('0120000000', 'Hello world');

$code = Sms::sendOtp('0120000000');
Read the quick start →