composer require alighale/sms
You must add the service provider to config/app.php
'providers' => [
// for laravel 5.8 and below
\Serjik\Sms\SmsServiceProvider::class,
];
Publish your config file
php artisan vendor:publish
.env
SMS_DRIVER=kavenegar // or another services
config/sms.php
/**
* sms driver
* [ 'kavenegar', 'ghasedak', ... ]
*/
'driver' => env('SMS_DRIVER'),
/**
* drivers config
*/
'drivers' => [
/**
* for install this service on your app run this:
* composer require kavenegar/php:1.2
*/
'kavenegar' => [
'api_key' => "kavenegar api key",
'line_number' => "10004346",
],
/**
* for install this service on your app run this:
* composer require ghasedak/php:"dev-master"
*/
'ghasedak' => [
'api_key' => "ghasedak api key",
'line_number' => "10008566",
// 'any_parameter' => 'any value',
],
// EXAMPLE
// 'your_driver' => [
// 'parameters' => '',
// 'provider' => \App\Sms\YourServiceName::class,
// ],
],
Title | Url | installer |
---|---|---|
kavenegar | https://kavenegar.com/ | composer require kavenegar/php:1.2 |
ghasedak | https://ghasedak.io/ | composer require ghasedak/php:"dev-master" |
We will add more services in the future. For use of services first install this package :)
// \Serjik\Sms\Facades\Sms
/** @var BaseSmsDriver $result */
$result = Sms::to('09210125463')->send('test package');
You can use the group service in two ways
Note: in all send methods the result is service result or array of that.
Send a fixed message to the numbers
/** @var BaseSmsDriver $result */
$result = Sms::to(['09210484017', ...])->send('test package');
Send number specific message. Send message[0] => number[0], .... and so on
/** @var BaseSmsDriver $result */
$result = Sms::to(['09210484017', ...])
->send(['test package', ....]);
$result = Sms::driver('driver_name')
->to('number or array of numbers')
->send('message or array of messages');