laravel-sms-gateway-kavenegar maintained by misaf
Description
Kavenegar SMS gateway driver for Laravel.
Author
Last update
2026/07/04 11:53
(dev-master)
License
Downloads
1
Tags
sms - laravel - sms-gateway - kavenegar - laravel-package - sms-api - sms-provider - sms-driver - kavenegar-sms
Laravel SMS Gateway Kavenegar Driver
Kavenegar driver package for misaf/laravel-sms-gateway.
This package registers the kavenegar driver. The core package provides the manager, facade, driver contract, shared configuration file, and SmsSent event.
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
misaf/laravel-sms-gateway
Installation
composer require misaf/laravel-sms-gateway-kavenegar
Laravel package discovery registers the driver service provider automatically.
Configuration
Publish the core configuration file if it has not already been published:
php artisan vendor:publish --tag=sms-gateway-config
Set the default driver and Kavenegar credentials in .env:
SMS_GATEWAY_DRIVER=kavenegar
SMS_GATEWAY_KAVENEGAR_API_KEY=your-api-key
SMS_GATEWAY_KAVENEGAR_GATEWAY=https://api.kavenegar.com/v1/
SMS_GATEWAY_KAVENEGAR_TIMEOUT=10
SMS_GATEWAY_KAVENEGAR_CONNECT_TIMEOUT=5
The driver reads from the kavenegar key in config/sms_gateway.php:
'kavenegar' => [
'apiKey' => env('SMS_GATEWAY_KAVENEGAR_API_KEY', ''),
'gateway' => env('SMS_GATEWAY_KAVENEGAR_GATEWAY', 'https://api.kavenegar.com/v1/'),
'timeout' => (int) env('SMS_GATEWAY_KAVENEGAR_TIMEOUT', env('SMS_GATEWAY_TIMEOUT', 10)),
'connect_timeout' => (int) env('SMS_GATEWAY_KAVENEGAR_CONNECT_TIMEOUT', env('SMS_GATEWAY_CONNECT_TIMEOUT', 5)),
],
Usage
use Misaf\LaravelSmsGateway\Facade\SmsGateway;
SmsGateway::driver('kavenegar')->send()->post('sms/send.json', [
'receptor' => '09123456789',
'message' => 'Hello',
]);
Kavenegar requests use the configured gateway and send the API key in the apikey header.
Events
After a request receives a response, the core package dispatches Misaf\LaravelSmsGateway\Events\SmsSent with the driver name, request, and response.
Testing
composer test
License
MIT