omarusman / laravel_notification_clicksend
:package_description
Requires
- php: >=5.5.9
- clicksend/clicksend-php: 4.0.*
- illuminate/notifications: 5.1.*|5.2.*|5.3.*
This package is auto-updated.
Last update: 2024-05-11 00:33:21 UTC
README
This package makes it easy to send notifications using ClickSend with Laravel 5.3.
Contents
Installation
You can install the package via composer:
composer require laravel-notification-channels/clicksend
You must install the service provider:
// config/app.php 'providers' => [ ... NotificationChannels\ClickSend\ClicksendProvider::class, ],
Setting up the ClickSend service
Add your ClickSend Username and API Key to your config/services.php
:
// config/services.php ... 'clicksend' => [ 'username' => env('CLICKSEND_USERNAME'), 'api_key' => env('CLICKSEND_API_KEY'), 'base_uri' => env('CLICKSEND_BASE_URI'), // optional ], ...
Usage
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\ClickSend\ClicksendChannel; use NotificationChannels\ClickSend\ClicksendSmsMessage; use Illuminate\Notifications\Notification; class OrderPaid extends Notification { public function via($notifiable) { return [ClicksendChannel::class]; } public function toClicksend($notifiable) { return (new ClicksendSmsMessage()) ->content("Thank you! You successfully paid for your Order #123"); } }
In order to let your Notification know which phone are you sending to, the channel will look for the sms
attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForClicksend
method to your Notifiable model.
public function routeNotificationForClicksend() { return '+1234567890'; }
Available methods
ClicksendSmsMessage
content('')
: Accepts a string value for the notification body.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email omar@clicksend.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.