|
| 1 | +# Cmsms notifications channel for Laravel 5.3 |
| 2 | + |
| 3 | +This package makes it easy to send [CM SMS messages](https://dashboard.onlinesmsgateway.com/docs) with Laravel 5.3. |
| 4 | + |
| 5 | +## Contents |
| 6 | + |
| 7 | +- [Requirements](#requirements) |
| 8 | +- [Installation](#installation) |
| 9 | +- [Setting up your Cmsms account](#setting-up-your-Cmsms-account) |
| 10 | +- [Usage](#usage) |
| 11 | +- [Changelog](#changelog) |
| 12 | +- [Testing](#testing) |
| 13 | +- [Security](#security) |
| 14 | +- [Contributing](#contributing) |
| 15 | +- [Credits](#credits) |
| 16 | +- [License](#license) |
| 17 | + |
| 18 | +## Requirements |
| 19 | + |
| 20 | +- [Sign up](https://dashboard.onlinesmsgateway.com) for a online sms gateway account |
| 21 | +- Find your HTTPS API key in your account settings |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +You can install the package via composer: |
| 26 | + |
| 27 | +``` bash |
| 28 | +composer require laravel-notification-channels/cmsms |
| 29 | +``` |
| 30 | + |
| 31 | +You must install the service provider: |
| 32 | + |
| 33 | +```php |
| 34 | +// config/app.php |
| 35 | +'providers' => [ |
| 36 | + ... |
| 37 | + NotificationChannels\Cmsms\CmsmsServiceProvider::class, |
| 38 | +], |
| 39 | +``` |
| 40 | + |
| 41 | +## Setting up your Cmsms account |
| 42 | + |
| 43 | +Add your Cmsms Product Token and default originator (name or number of sender) to your `config/services.php`: |
| 44 | + |
| 45 | +```php |
| 46 | +// config/services.php |
| 47 | +... |
| 48 | +'cmsms' => [ |
| 49 | + 'product_token' => env('CMSMS_PRODUCT_TOKEN'), |
| 50 | + 'originator' => env('CMSMS_ORIGINATOR'), |
| 51 | +], |
| 52 | +... |
| 53 | +``` |
| 54 | + |
| 55 | +Notice: The originator can contain a maximum of 11 alfanumeric characters. |
| 56 | + |
| 57 | +## Usage |
| 58 | + |
| 59 | +Now you can use the channel in your `via()` method inside the notification: |
| 60 | + |
| 61 | +``` php |
| 62 | +use NotificationChannels\Cmsms\CmsmsChannel; |
| 63 | +use NotificationChannels\Cmsms\CmsmsMessage; |
| 64 | +use Illuminate\Notifications\Notification; |
| 65 | + |
| 66 | +class VpsServerOrdered extends Notification |
| 67 | +{ |
| 68 | + public function via($notifiable) |
| 69 | + { |
| 70 | + return [CmsmsChannel::class]; |
| 71 | + } |
| 72 | + |
| 73 | + public function toCmsms($notifiable) |
| 74 | + { |
| 75 | + return (new CmsmsMessage("Your {$notifiable->service} was ordered!")); |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +**Important note**: CMCMS requires the recipients phone number to be in international format. For instance: 0031612345678 |
| 81 | + |
| 82 | +## Changelog |
| 83 | + |
| 84 | +Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
| 85 | + |
| 86 | +## Testing |
| 87 | + |
| 88 | +``` bash |
| 89 | +$ composer test |
| 90 | +``` |
| 91 | + |
| 92 | +## Security |
| 93 | + |
| 94 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 95 | + |
| 96 | +## Contributing |
| 97 | + |
| 98 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 99 | + |
| 100 | +## Credits |
| 101 | + |
| 102 | +- [Michel Bardelmeijer](https://github.com/mbardelmeijer) |
| 103 | +- [All Contributors](../../contributors) |
| 104 | + |
| 105 | +Special thanks to [Peter Steenbergen](http://petericebear.github.io) for the MessageBird template from where this is mostly based on. |
| 106 | + |
| 107 | +## License |
| 108 | + |
| 109 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments