Skip to content
Smspoh Notifications Channel for Laravel
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.editorconfig
.gitattributes
.gitignore
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
phpunit.xml.dist

README.md

Smspoh Notifications Channel for Laravel

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

This package makes it easy to send notifications using SmsPoh with Laravel 5.5+ and 6.0

Contents

Installation

You can install this package via composer:

composer require laravel-notification-channels/smspoh

Setting up the Smspoh service

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

// config/services.php
...
'smspoh' => [
    'endpoint' => env('SMSPOH_ENDPOINT', 'https://smspoh.com/api/v2/send'),
    'token' => env('SMSPOH_TOKEN', 'YOUR SMSPOH TOKEN HERE'),
    'sender' => env('SMSPOH_SENDER', 'YOUR SMSPOH SENDER HERE')
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\Smspoh\SmspohMessage;

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

    public function toSmspoh($notifiable)
    {
        return (new SmspohMessage)->content("Your account was approved!");       
    }
}

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

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

On-Demand Notifications

Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:

Notification::route('smspoh', '5555555555')                      
            ->notify(new InvoicePaid($invoice));

Available Message methods

sender(): Sets the sender's name. Make sure to register the sender name at you SmsPoh dashboard.

content(): Set a content of the notification message. This parameter should be no longer than 918 char(6 message parts),

test(): Send a test message to specific mobile number or not. This parameter should be boolean and default value is true.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

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

You can’t perform that action at this time.