Skip to content

mpociot/cmsms

 
 

Repository files navigation

CMSMS notifications channel for Laravel 5.3

This package makes it easy to send CMSMS messages with Laravel 5.3.

Contents

Requirements

  • Sign up for a online sms gateway account
  • Find your HTTPS API key in your account settings

Installation

You can install the package via composer:

composer require laravel-notification-channels/cmsms

You must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\Cmsms\CmsmsServiceProvider::class,
],

Setting up your CMSMS account

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 alfanumeric characters.

Usage

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 (new CmsmsMessage("Your {$notifiable->service} was ordered!"));
    }
}

Important note: CMCMS requires the recipients phone number to be in international format. For instance: 0031612345678

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email michel@enflow.nl instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

Special thanks to Peter Steenbergen for the MessageBird template from where this is mostly based on.

License

The MIT License (MIT). Please see License File for more information.

About

CMSMS notifications channel for Laravel 5.3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%