daemon144key/zenziva-notification-channel

Zenziva SMS notifications driver.

1.0.0 2019-09-22 18:55 UTC

This package is not auto-updated.

Last update: 2024-11-10 06:33:31 UTC


README

Latest Version on Packagist Software License Build Status StyleCI Total Downloads

This package makes it easy to send SMS notifications using zenziva.id with Laravel 5.3 onward.

Contents

Installation

You can install the package via composer:

composer require daemon144key/zenziva-notification-channel

You must install the service provider and add to your config/app.php (skip for Laravel 5.5 onward):

// config/app.php
'providers' => [
    ...
    TuxDaemon\ZenzivaNotificationChannel\ZenzivaServiceProvider::class,
],

Additionally you can add related facade in config/app.php :

// config/app.php
'aliases' => [
    ...
    'ZenzivaClient' => TuxDaemon\ZenzivaNotificationChannel\Facades\ZenzivaFacade::class,
],

Setting up the zenziva-notification-channel service

Add your Zenziva account userkey and passkeyto your config/services.php:

// config/services.php
...
'zenziva' => [
    'userkey' => env('ZENZIVA_SMS_CLIENT_USERKEY', ''),
    'passkey' => env('ZENZIVA_SMS_CLIENT_PASSKEY', ''),
    'masking' => env('ZENZIVA_SMS_CLIENT_MASKING', false)
],
...

Usage

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

use Illuminate\Notifications\Notification;
use TuxDaemon\ZenzivaNotificationChannel\ZenzivaMessage;
use TuxDaemon\ZenzivaNotificationChannel\ZenzivaChannel;

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

    public function toZenziva($notifiable)
    {
        return ZenzivaMessage::create("Your order had created!");
    }
}

Or call the function from facade :

use ZenzivaClient;

class Something
{
    public function send($to, $msg)
    {
        return ZenzivaClient::send("081234567890", "hello world");
    }

    public function checkBalance()
    {
        return ZenzivaClient::checkBalance();
    }
}

Or from CLI artisan command :

$ php artisan zenziva:send 081234567890 "hello world"
$ php artisan zenziva:checkbalance

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Contributing

Please see CONTRIBUTING for details.

License

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