Package Data | |
---|---|
Maintainer Username: | laravel-notification-channels |
Maintainer Contact: | michel@enflow.nl (Michel Bardelmeijer) |
Package Create Date: | 2016-08-31 |
Package Last Update: | 2024-03-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-04 03:15:20 |
Package Statistics | |
---|---|
Total Downloads: | 12,117 |
Monthly Downloads: | 346 |
Daily Downloads: | 32 |
Total Stars: | 8 |
Total Watchers: | 6 |
Total Forks: | 8 |
Total Open Issues: | 0 |
This package makes it easy to send CMSMS messages with Laravel 5.3.
You can install the package via composer:
composer require laravel-notification-channels/cmsms
You must install the service provider for Laravel 5.4 and below:
// config/app.php
'providers' => [
...
NotificationChannels\Cmsms\CmsmsServiceProvider::class,
],
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Add your CMSMS Product Token and default originator (name or number of sender) to your config/services.php
:
// config/services.php
...
'cmsms' => [
'product_token' => env('CMSMS_PRODUCT_TOKEN'),
'originator' => env('CMSMS_ORIGINATOR'),
],
...
Notice: The originator can contain a maximum of 11 alphanumeric characters.
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\Cmsms\CmsmsChannel;
use NotificationChannels\Cmsms\CmsmsMessage;
use Illuminate\Notifications\Notification;
class VpsServerOrdered extends Notification
{
public function via($notifiable)
{
return [CmsmsChannel::class];
}
public function toCmsms($notifiable)
{
return CmsmsMessage::create("Your {$notifiable->service} was ordered!");
}
}
In order to let your Notification know which phone numer you are targeting, add the routeNotificationForCmsms
method to your Notifiable model.
Important note: CMCMS requires the recipients phone number to be in international format. For instance: 0031612345678
public function routeNotificationForCmsms()
{
return '0031612345678';
}
body('')
: Accepts a string value for the message body.originator('')
: Accepts a string value between 1 and 11 characters, used as the message sender name.reference('')
: Accepts a string value for your message reference. This information will be returned in a status report so you can match the message and it's status. Restrictions: 1 - 32 alphanumeric characters and reference will not work for demo accounts.tariff()
: Accepts a integer value for your message tariff. The unit is eurocent. Requires the originator
to be set to a specific value. Contact CM for this value and to enable this feature for your contract.multipart($minimum, $maximum)
: Accepts a 0 to 8 integer range which allows multipart messages. See the documentation from CM for more information.Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email michel@enflow.nl instead of using the issue tracker.
Please see CONTRIBUTING for details.
Special thanks to Peter Steenbergen for the MessageBird template from where this is mostly based on.
The MIT License (MIT). Please see License File for more information.