omarusman / laravel_notification_clicksend by omarusman

:package_description
27
0
1
Package Data
Maintainer Username: omarusman
Maintainer Contact: omar@clicksend.com (Omar Usman)
Package Create Date: 2016-11-18
Package Last Update: 2016-11-19
Language: PHP
License: MIT
Last Refreshed: 2024-04-23 03:14:44
Package Statistics
Total Downloads: 27
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 2
Total Open Issues: 0

ClickSend Laravel Notification Channel

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

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.