2017 © Pedro Peláez
 

library semysms

SemySMS Notifications Channel for Laravel

image

zanozik/semysms

SemySMS Notifications Channel for Laravel

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 27 % Grown

The README.md

SemySMS Notifications Channel

Latest Version on Packagist Software License, (*1)

Installation

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

``` bash composer require zanozik/semysms, (*3)


You must install the service provider: ```php // config/app.php 'providers' => [ ... NotificationChannels\SemySMS\SemySMSServiceProvider::class, ],

Setting up the SemySMS service

Sign up on SemySMS and create your token in your Control Panel -> API., (*4)

Add the following section and fill in the details there (you can also use your .env file to store your credentials):, (*5)

// config/services.php
...
'semysms' => [
    'token' => env('SEMYSMS_TOKEN', '12345678901234567890'),
    'device' => env('SEMYSMS_DEVICE', '12345')
],
...

Usage

You can now use the channel in your via() method inside the Notification class., (*6)

``` php use NotificationChannels\SemySMS\SemySMSChannel; use NotificationChannels\SemySMS\SemySMSMessage; use Illuminate\Notifications\Notification;, (*7)

class InvoicePaid extends Notification{, (*8)

public function via($notifiable){
    return [SemySMSChannel::class];
}

public function toSmsGatewayMe($notifiable){
    return (new SemySMSMessage)->text('Your invoice has been paid');
}

}, (*9)


### Routing a message You should add a `routeNotificationForSemySMS()` method in your notifiable model: ``` php ... /** * Route notifications for the SemySMS channel. * * @return int */ public function routeNotificationForSemySMS(){ return $this->phone_number; } ...

Available methods

  • text($text): (string) SMS Text.

License

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

The Versions