https://github.com/laravel-notification-channels/sms-broadcast
Laravel Notification Channel for Sms Broadcast
https://github.com/laravel-notification-channels/sms-broadcast
Last synced: 8 months ago
JSON representation
Laravel Notification Channel for Sms Broadcast
- Host: GitHub
- URL: https://github.com/laravel-notification-channels/sms-broadcast
- Owner: laravel-notification-channels
- License: mit
- Created: 2019-09-12T12:21:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-18T07:05:24.000Z (almost 2 years ago)
- Last Synced: 2025-03-29T18:41:24.322Z (9 months ago)
- Language: PHP
- Homepage: https://laravel-notification-channels.com
- Size: 22.5 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Sms Broadcast Notification Channel
This package makes it easy to send notifications using [Sms Broadcast](https://www.smsbroadcast.com.au/) with Laravel > 5.6 & 6.0.
It uses my [Sms Broadcast PHP package](https://github.com/atymic/sms-broadcast-php) under the hood.
## Contents
- [Installation](#installation)
- [Setting up the Sms Broadcast service](#setting-up-the-Sms Broadcast-service)
- [Usage](#usage)
- [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
## Installation
Install the package using composer
```bash
composer require laravel-notification-channels/sms-broadcast
```
Add the configuration to your `services.php` config file:
```php
'smsbroadcast' => [
'username' => env('SMS_BROADCAST_USERNAME'),
'password' => env('SMS_BROADCAST_PASSWORD'),
'default_sender' => env('SMS_BROADCAST_DEFAULT_SENDER', null),
]
```
## Usage
You can use the channel in your `via()` method inside the notification:
```php
use Illuminate\Notifications\Notification;
use NotificationChannels\SmsBroadcast\SmsBroadcastMessage;
use NotificationChannels\SmsBroadcast\SmsBroadcastChannel;
class AccountApproved extends Notification
{
public function via($notifiable)
{
return [SmsBroadcastChannel::class];
}
public function toSmsbroadcast($notifiable)
{
return (new SmsBroadcastMessage)
->content("Task #{$notifiable->id} is complete!");
}
}
```
In your notifiable model, make sure to include a `routeNotificationForSmsbroadcast()` method, which returns an australian phone number.
```php
public function routeNotificationForSmsbroadcast()
{
return $this->phone; // 0412345678 or 6142345678
}
```
### Available methods
`sender()`: Sets the sender's name or phone number.
`content()`: Set a content of the notification message.
`delay()`: Set a delay, in minutes before sending the message
`reference()`: Set the SMS ref code
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [atymic](https://github.com/atymic)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.