-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
notification class vendor swap added
- Loading branch information
1 parent
095430f
commit ff93b12
Showing
6 changed files
with
140 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Configuration | ||
|
||
Please follow this steps and you are live with in a mere seconds. | ||
|
||
## General Configuration | ||
|
||
1. On notification classes add SMS channel on the like this. | ||
```php | ||
public function via(object $notifiable): array | ||
{ | ||
return ['sms', '...other channel']; | ||
} | ||
``` | ||
2. On the `.env` file please add this configuration. | ||
```shell | ||
SMS_LOG=false | ||
SMS_DRIVER="twilio" | ||
SMS_ACCOUNT_MODE="sandbox" | ||
SMS_FROM_NAME="${APP_NAME}" | ||
``` | ||
|
||
## Driver Configuration | ||
|
||
Depending on driver option you choose, add these API credentials | ||
after existing general configuration variables. | ||
|
||
| Driver | Credentials | | ||
|------------------|-------------------------------------------------------------------------| | ||
| `africastalking` | `SMS_AFRICA_TALKING_API_KEY=null`<br>`SMS_AFRICA_TALKING_USERNAME=null` | | ||
| `clickatell` | `SMS_CLICKATELL_API_KEY=null` | | ||
| `clicksend` | `SMS_CLICKSEND_USERNAME=null`<br>`SMS_CLICKSEND_PASSWORD=null` | | ||
| `infobip` | `SMS_INFOBIP_API_TOKEN=null` | | ||
| `messagebird` | `SMS_MESSAGE_BIRD_ACCESS_KEY=null` | | ||
| `smsbroadcast` | `SMS_SMSBROADCAST_USERNAME=null`<br>`SMS_SMSBROADCAST_PASSWORD=null` | | ||
| `telnyx` | `SMS_TELNYX_API_TOKEN=null` | | ||
| `twilio` | `SMS_TWILIO_USERNAME=null`<br>`SMS_TWILIO_PASSWORD=null` | | ||
|
||
|
||
## Notification Class | ||
|
||
On the notification class the `via()` will look like this | ||
after adding the sms channel | ||
```php | ||
public function via(object $notifiable): array | ||
{ | ||
return ['sms', '...other']; | ||
} | ||
``` | ||
OR | ||
|
||
```php | ||
use Laraflow\Sms\SmsChannel; | ||
|
||
public function via(object $notifiable): array | ||
{ | ||
return [SmsChannel::class, '...other']; | ||
} | ||
``` | ||
|
||
And the message prepare method should be named `toSms` and | ||
return type is `SmsMessage` class instance. | ||
Such example is given below. | ||
|
||
```php | ||
use Laraflow\Sms\SmsMessage; | ||
|
||
public function toSms(object $notifiable): SmsMessage | ||
{ | ||
return (new SmsMessage) | ||
->to('88012345678910') | ||
->message('Hello from Laraflow SMS') | ||
->vendor('telnyx') //Optional, will overwrite config file | ||
->from('Laraflow'); //Optional, will overwrite config file | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters