coreproc/laravel-notification-channel-playsms

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

1.0.0 2020-02-07 05:28 UTC

This package is auto-updated.

Last update: 2024-04-07 15:23:11 UTC


README

Latest Version on Packagist Software License StyleCI Quality Score Total Downloads

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

Contents

Installation

Install this package with Composer:

composer require coreproc/laravel-notification-channel-playsms

Setting up the playSMS service

A web server with playSMS installed is required to use this service. Visit https://help.playsms.org/en/ to check out set up / installation instruction for playSMS.

Once you have a playSMS server up and running, you can obtain an API key by going to My Account -> User Configuration. You'll be able to see your webservices token in that page. Use this as your API key.

Add the base URL of your playSMS server, your username, and your API key to your config/services.php.

// config/services.php
....
'playsms' => [
    'base_url' => env('PLAYSMS_BASE_URL'),
    'username' => env('PLAYSMS_USERNAME'),
    'api_key' => env('PLAYSMS_API_KEY'),
],
...

Usage

Sending a playSMS notification can be done by making a Notification class with the following:

use CoreProc\NotificationChannels\PlaySms\PlaySmsChannel;
use CoreProc\NotificationChannels\PlaySms\PlaySmsMessage;
use Illuminate\Notifications\Notification;

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

    public function toPlaySms($notifiable)
    {
        return (new PlaySmsMessage())->setMessage('Your account has been activated!');
    }
}

Available Message methods

The PlaySmsMessage has only one method available as of now:

setMessage($message)

Use this method to set the content of the SMS being sent.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email ask@coreproc.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

About CoreProc, Inc.

CoreProc, Inc. is a software development company that provides software development services to startups, digital/ad agencies, and enterprises.

Learn more about us on our website.

License

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