2017 © Pedro Peláez
 

library gosms

GoSMS Notifications channel for Laravel 5.3.

image

shiroamada/gosms

GoSMS Notifications channel for Laravel 5.3.

  • Saturday, October 28, 2017
  • by shiroamada
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

GoSms notifications channel for Laravel 5.3+

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

This package makes it easy to send notifications using https://gosms.com.my with Laravel 5.3+., (*2)

Code Reference from laravel-notification-channels/smsc-ru, (*3)

Contents

Installation

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

composer require shiroamada/gosms

Then you must install the service provider:, (*5)

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

Setting up the GoSMS service

Add your gosms.com.my login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:, (*6)

// config/services.php
...
'gosms' => [
    'company'   => env('GOSMS_COMPANY'),
    'username'  => env('GOSMS_USERNAME'),
    'password'  => env('GOSMS_PASSWORD'),
    'sender'    => env('GOSMS_SENDER'),
    'gateway'   => env('GOSMS_GATEWAY', 'L'),
    'mode'      => env('GOSMS_MODE', 'BUK'),
    'type'      => env('GOSMS_TYPE', 'TX'),
    'charge'    => env('GOSMS_CHARGE', '0'),
    'maskid'    => env('GOSMS_MASKID', '1'),
    'convert'   => env('GOSMS_CONVERT', '0')
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\GoSms\GoSmsMessage;
use NotificationChannels\GoSms\GoSmsChannel;

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

    public function toGoSms($notifiable)
    {
        return GoSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForGoSms() method, which return the phone number., (*8)

public function routeNotificationForGoSms()
{
    return $this->mobile; //depend what is your db field
}

Available methods

from(): Sets the sender's name or phone number., (*9)

content(): Set a content of the notification message., (*10)

sendAt(): Set a time for scheduling the notification message., (*11)

Changelog

Please see CHANGELOG for more information what has changed recently., (*12)

Testing

bash $ composer test, (*13)

Security

If you discover any security related issues, please use 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