2017 © Pedro Peláez
 

library messagebird

MessageBird notification channel for Laravel 5.3

image

laravel-notification-channels/messagebird

MessageBird notification channel for Laravel 5.3

  • Wednesday, June 6, 2018
  • by laravel-notification-channels
  • Repository
  • 4 Watchers
  • 7 Stars
  • 18,243 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 5 Versions
  • 21 % Grown

The README.md

Messagebird notifications channel for Laravel

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads, (*1)

This package makes it easy to send Messagebird SMS notifications with Laravel., (*2)

Contents

Requirements

  • Sign up for a free MessageBird account
  • Create a new access_key in the developers sections

Installation

You can install the package via composer:, (*3)

``` bash composer require laravel-notification-channels/messagebird, (*4)


for Laravel 5.4 or lower, you must add the service provider to your config: ```php // config/app.php 'providers' => [ ... NotificationChannels\Messagebird\MessagebirdServiceProvider::class, ],

Setting up your Messagebird account

Add the environment variables to your config/services.php:, (*5)

// config/services.php
...
'messagebird' => [
    'access_key' => env('MESSAGEBIRD_ACCESS_KEY'),
    'originator' => env('MESSAGEBIRD_ORIGINATOR'),
    'recipients' => env('MESSAGEBIRD_RECIPIENTS'),
],
...

Add your Messagebird Access Key, Default originator (name or number of sender), and default recipients to your .env:, (*6)

// .env
...
MESSAGEBIRD_ACCESS_KEY=
MESSAGEBIRD_ORIGINATOR=
MESSAGEBIRD_RECIPIENTS=
],
...

Notice: The originator can contain a maximum of 11 alfa-numeric characters., (*7)

Usage

Now you can use the channel in your via() method inside the notification:, (*8)

``` php use NotificationChannels\Messagebird\MessagebirdChannel; use NotificationChannels\Messagebird\MessagebirdMessage; use Illuminate\Notifications\Notification;, (*9)

class VpsServerOrdered extends Notification { public function via($notifiable) { return [MessagebirdChannel::class]; }, (*10)

public function toMessagebird($notifiable)
{
    return (new MessagebirdMessage("Your {$notifiable->service} was ordered!"));
}

}, (*11)


Additionally you can add recipients (single value or array) ``` php return (new MessagebirdMessage("Your {$notifiable->service} was ordered!"))->setRecipients($recipients);

In order to handle a status report you can also set a reference, (*12)

``` php return (new MessagebirdMessage("Your {$notifiable->service} was ordered!"))->setReference($id);, (*13)


## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test

Security

If you discover any security related issues, please email psteenbergen@gmail.com instead of using the issue tracker., (*14)

Contributing

Please see CONTRIBUTING for details., (*15)

Credits

License

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

The Versions