This is a Laravel Package for SMS Integrations. This package supports Laravel 5.8+
.
This packages works with multiple drivers, and you can create custom drivers if you can't find them in the current drivers list (below list).
- ippanel ✔️
- Others are under way.
Help me to add the gateways below by creating pull requests
Via Composer
$ composer require mahdigraph/laravel-sms
If you are using Laravel 5.5
or higher then you don't need to add the provider and alias. (Skip to b)
a. In your config/app.php
file add these two lines.
// In your providers array.
'providers' => [
...
\Metti\LaravelSms\LaravelSMSServiceProvider::class,
],
// In your aliases array.
'aliases' => [
...
'SendSMS' => \Metti\LaravelSms\Facade\SendSMS::class,
],
b. then run php artisan vendor:publish
to publish config/sms.php
file in your config directory.
In the config file you can set the default driver
to use for all your sms requests. But you can also change the driver at runtime.
Choose what sms provider you would like to use in your application. Then make that as default driver so that you don't have to specify that everywhere. But, you can also use multiple sms providers in a project.
// Eg. if you want to use ippanel.
'default' => 'ippanel',
Then fill the credentials for that driver in the drivers array.
'drivers' => [
'ippanel' => [
// Fill in the credentials here.
'key' => '00000000-0000-0000-0000-000000000000', // API Key
'originator' => '+9890000', // Sender Number
'patterns' => [ // patterns only if you want to use them.
'contact' => [ // pattern name
'pattern_code' => 'abcd-efgh-ijkl-mnop', // pattern code from your sms provider
'values' => [ // values only if you want to set default values for your patterns.
'support_phone' => '021-123456789'
]
]
]
],
...
]
// Sending Text Messages
SendSMS::textMessage('Hey You :)')
->recipients(['09121234567','09121234568'])
->send();
// Sending Pattern Messages
SendSMS::via('ippanel')
->patternMessage('contact',['support_phone' => '021-123456789'])
->recipients('09121234567')
->send();
If you discover any security related issues, please email immahdigraph@gmail.com instead of using the issue tracker.
The MIT License (MIT).