verifiedit/laravel-notification-channel-clicksend

ClickSend notification channel for Laravel

2.2.1 2024-03-18 09:01 UTC

This package is auto-updated.

Last update: 2024-10-25 09:47:24 UTC


README

Please see this repo for instructions on how to submit a channel proposal.

A Boilerplate repo for contributions

Packagist Version (including pre-releases) Software License PHPUnit tests Standards Total Downloads

This package makes it easy to send notifications using ClickSend with Laravel 5.5+, 6.x, 7.x, 8.x, 9.x, 10.x and 11.x.

Contents

Installation

You can install the package via composer:

$ composer require verifiedit/laravel-notification-channel-clicksend

Setting up the ClickSend service

Add your ClikSend details to your .env:

CLICKSEND_DRIVER=clicksend
CLICKSEND_ENABLED=true
CLICKSEND_USERNAME=XYZ
CLICKSEND_APIKEY=XYZ
CLICKSEND_SMS_FROM=XYZ

Usage

You can use the channel in your via() method inside the notification:

use NotificationChannels\ClickSend\ClickSendChannel;
use NotificationChannels\ClickSend\ClickSendMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [ClickSendChannel::class];
    }

    public function toClickSend($notifiable)
    {
        return (new ClickSendMessage())
            ->setContent("Your {$notifiable->service} account was approved!");
    }
}

In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForClickSend method to your Notifiable model.

public function routeNotificationForClickSend()
{
    return $this->phone_number;
}

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email developers@verified.com.au 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.