innoflash/za-sms
Composer 安装命令:
composer require innoflash/za-sms
包简介
An SMS package to handle SMS sending from South African providers
关键字:
README 文档
README
Table of contents
Introduction
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:
Install
composer require innoflash/za-sms
Usage
Once the package is installed you will need to set the provider in the .ENV file as follows:
ZA_SMS_PROVIDER={provider}
Available providers:
Use as a notification
za-sms supports being a driver for Laravel Notification
- In the
Notifiableclass set your model phone number field by overriding this
function routeNotificationForZasms($notification) { return $this->phone_number; }
- In the
Notificationclass 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 }
Use as a Facade
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();
Additionally
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 }
Contributing
- Please see CONTRIBUTING for details.
- Add a provider using this manual
Security
If you discover any security-related issues, please email innocentmazando@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 69
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-16