This package is aimed at creating a South African SMS package for for local SMS providers using their REST APIs. Below is a list of providers we currently integrated:
composer require innoflash/za-sms
Once the package is installed you will need to set the provider in the .ENV
file as follows:
ZA_SMS_PROVIDER={provider}
Available providers:
za-sms supports being a driver for Laravel Notification
- In the
Notifiable
class set your model phone number field by overriding this
function routeNotificationForZasms($notification)
{
return $this->phone_number;
}
- In the
Notification
class use the za-sms as follows
public function via($notifiable)
{
return [ZaSMSChannel::class];
}
- Then create the notification body as follows
function toZaSMS($notifiable)
{
return (new ZaSMS)
->message('This is my message')
->sendAt(now()->addDays(2)) // for scheduling messegaes
->campaign('my campain'); //for message campaining
}
At times you would want to send the SMS your own way so you can use the ZaSMS
facade
ZaSMS::setRecipientNumber('0651562779')
->setMessage('the facade message')
->sendMessage();
//or
ZaSMS::setMessageData([
'recipientNumber' => '0027651562779',
'message' => 'data message'
])->sendMessage();
You can also access the SMS Provider object using all available service container methods
$provider = app()->make('za-sms');
$provider = app()->make(SMSProviderContract::class);
$provider = resolve('za-sms');
$provider = resolve(SMSProviderContract::class);
//or use dependency injection
function myFunction(SMSProviderContract $provider){
//todo use the provider
}
- Please see CONTRIBUTING for details.
- Add a provider using this manual
If you discover any security-related issues, please email innocentmazando@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.