Giter Site home page Giter Site logo

every8d's Introduction

Every8d notifications channel for Laravel 5.3+

StyleCI Build Status Total Downloads Latest Stable Version Latest Unstable Version License Monthly Downloads Daily Downloads Scrutinizer Code Quality Code Coverage

This package makes it easy to send notifications using [every8d] with Laravel 5.3+.

Contents

Installation

You can install the package via composer:

composer require recca0120/every8d illuminate/notifications php-http/guzzle6-adapter

Then you must install the service provider:

// config/app.php
'providers' => [
    ...
    Recca0120\Every8d\Every8dServiceProvider::class,
],

Setting up the Every8d service

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

// config/services.php
...
'every8d' => [
    'user_id'  => env('EVERY8D_USER_ID'),
    'password' => env('EVERY8D_PASSWORD'),
],
...

Usage

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

use Recca0120\Every8d\Every8dMessage;
use Recca0120\Every8d\Every8dChannel;
use Illuminate\Notifications\Notification;

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

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

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

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

Available methods

subject(): Sets a subject of the notification subject.

content(): Sets a content of the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] 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.

API Only

composer require recca0120/every8d php-http/guzzle6-adapter

How to use

require __DIR__.'/vendor/autoload.php';

use Recca0120\Every8d\Client;

$userId = 'xxx';
$password = 'xxx';

$client = new Client(userId, $password);

$client->credit(); // 取得額度
var_dump($client->send([
    'to' => '09xxxxxxxx',
    'text' => 'test message',
]));
/*
return [
    'credit' => 100.0,
    'sended' => 1,
    'cost' => 1.0,
    'unsend' => 0,
    'batchId' => 'd0ad6380-4842-46a5-a1eb-9888e78fefd8',
];
 */

every8d's People

Contributors

recca0120 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.