nerdify/laravel-smsgateway-notification-channel

This package is abandoned and no longer maintained. No replacement package was suggested.

This package makes it easy to send notifications using SMS Gateway with Laravel.

Maintainers

Package info

github.com/nerdify/laravel-smsgateway-notification-channel

pkg:composer/nerdify/laravel-smsgateway-notification-channel

Statistics

Installs: 41

Dependents: 0

Suggesters: 0

Stars: 12

Open Issues: 0

v1.1.0 2018-06-02 00:25 UTC

This package is not auto-updated.

Last update: 2022-11-26 17:32:55 UTC


README

Latest Version on Packagist Software License StyleCI

This package makes it easy to send notifications using SMS Gateway with Laravel.

Contents

Requirements

Sign up for a online sms gateway account.

Installation

You can install the package via composer:

composer require nerdify/laravel-smsgateway-notification-channel

You must install the service provider:

// config/app.php
'providers' => [
    ...
    Nerdify\SmsGateway\SmsGatewayServiceProvider::class,
],

Setting up your SMS Gateway account

Add your SMS Gateway email, password, and device ID to your config/services.php:

// config/services.php
...
'smsgateway' => [
    'email' => env('SMSGATEWAY_EMAIL'),
    'password' => env('SMSGATEWAY_PASSWORD'),
    'device' => env('SMSGATEWAY_DEVICE'),
],
...

Usage

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

use Illuminate\Notifications\Notification;
use Nerdify\SmsGateway\SmsGatewayChannel;
use Nerdify\SmsGateway\SmsGatewayMessage;

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

    public function toSmsGateway($notifiable)
    {
        return (new SmsGatewayMessage)
            ->content('Your invoice has been paid!');
    }
}

When sending notifications, the notification system will automatically look for a phone_number attribute on the notifiable entity. If you would like to customize the phone number the notification is delivered to, define a routeNotificationForSmsGateway method on the entity:

public function routeNotificationForSmsGateway()
{
    return '+1234567890';
}

Available Message methods

SmsGatewayMessage

  • content(): The content of the message to be sent.
  • expiresAt(): Time to give up trying to send the message at in Unix Time format.
  • sendAt(): Time to send the message in Unix Time format.

License

The MIT License (MIT). Please see License File for more information.