fomvasss/laravel-notification-channel-sendberry

This package makes it easy to send notifications using [sendberry.com](https://sendberry.com) with Laravel 9.0+

1.0.1 2023-10-27 12:08 UTC

This package is auto-updated.

Last update: 2024-12-25 16:24:54 UTC


README

Here's the latest documentation on Laravel's Notifications System:

https://laravel.com/docs/master/notifications

Latest Version on Packagist Software License Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using sendberry.com with Laravel 9.0+.

Contents

Installation

Install this package with Composer:

composer require fomvasss/laravel-notification-channel-sendberry

The service provider gets loaded automatically. Or you can do this manually:

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

Setting up

Add your Sendberry token, default sender name (or phone number), test mode to your config/services.php:

// config/services.php
...
'sendberry' => [
    'username'  => env('SENDBERRY_USERNAME'),
    'password'  => env('SENDBERRY_PASSWORD'),
    'auth_key'  => env('SENDBERRY_AUTH_KEY'),
    'from'  => env('SENDBERRY_FROM'),
    'webhook'  => env('SENDBERRY_WEBHOOK'),
    'test_mode'  => env('SENDBERRY_TEST_MODE', false),
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\Sendberry\SendberryMessage;
use NotificationChannels\Sendberry\SendberryChannel;

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

    public function toSendberry($notifiable)
    {
        return (new SendberryMessage())->content("Hello SMS!!!")->test(true);
    }
}

In your notifiable model, make sure to include a routeNotificationForSendberry() method, which returns a phone number or an array of phone numbers.

public function routeNotificationForSendberry()
{
    return $this->phone;
}

Available methods

from(): Sets the sender's name or phone number, for test use "Info SMS".

content(): Set a content of the notification message.

date(): Example argument = 12.05.2020

time(): Example argument = 13:00

test(): Test SMS sending

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email fomvasss@gmail.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.