Skip to content

zek/netgsm-1

 
 

Repository files navigation

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

This package makes it easy to send notifications using NetGsm with Laravel 5.3 - 7.x.

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/netgsm

Setting up the NetGsm service

Add the environment variables to your config/services.php:

// config/services.php
...
'netgsm' => [
    'user_code' => env('NETGSM_USER_CODE'),
    'secret' => env('NETGSM_SECRET'),
    'msg_header' => env('NETGSM_HEADER'),
],
...

Add your NetGsm User Code, Default header (name or number of sender), and secret (password) to your .env:

// .env
...
NETGSM_USER_CODE=
NETGSM_SECRET=
NETGSM_HEADER=
],
...

Usage

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

use NotificationChannels\NetGsm\NetGsmChannel;
use NotificationChannels\NetGsm\NetGsmMessage;
use Illuminate\Notifications\Notification;

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

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

You can add recipients (single value or array)

return (new NetGsmMessage("Your {$notifiable->service} was ordered!"))->setRecipients($recipients);

Additionally you can change header

return (new NetGsmMessage("Your {$notifiable->service} was ordered!"))->setHeader("COMPANY");

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

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

About

NetGsm notification channel for Laravel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%