2017 © Pedro Peláez
 

library laravel-notification-chatwork

Chatwork notifications channel for Laravel. (v2)

image

revolution/laravel-notification-chatwork

Chatwork notifications channel for Laravel. (v2)

  • Saturday, December 23, 2017
  • by revolution
  • Repository
  • 1 Watchers
  • 0 Stars
  • 378 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 36 Forks
  • 0 Open issues
  • 5 Versions
  • 8 % Grown

The README.md

Chatwork Notifications Channel for Laravel 5.3

Latest Version on Packagist Software License, (*1)

This package makes it easy to send Chatwork messages using Chatwork API with Laravel 5.3., (*2)

Contents

Installation

You can install the package via composer:, (*3)

``` bash composer require e2kaneko/laravel-chatwork-notifications, (*4)


You must install the service provider: ```php // config/app.php 'providers' => [ ... NotificationChannels\Chatwork\ChatworkServiceProvider::class, ],

Configuration

Configure your credentials:, (*5)

// config/services.php
...
'chatwork' => [
    'api_token' => env('CHATWORK_API_TOKEN'),
],
...

Usage

You can now use the channel in your via() method inside the Notification class., (*6)

``` php <?php, (*7)

namespace App\Notifications;, (*8)

use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use NotificationChannels\Chatwork\ChatworkMessage; use NotificationChannels\Chatwork\ChatworkChannel;, (*9)

class ChatworkPosted extends Notification {, (*10)

use Queueable;

public function __construct()
{
}

public function via($notifiable)
{
    return [ChatworkChannel::class];
}

public function toChatwork($notifiable)
{
    return (new ChatworkMessage())
                    ->message('message');
}

}, (*11)


or ``` php <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use NotificationChannels\Chatwork\ChatworkInformation; use NotificationChannels\Chatwork\ChatworkChannel; class ChatworkPosted extends Notification { use Queueable; public function __construct() { } public function via($notifiable) { return [ChatworkChannel::class]; } public function toChatwork($notifiable) { return (new ChatworkInformation()) ->informationTitle('InformationTitle') ->informationMessage('InformationMessage'); } }

Routing a message

You can either send the notification by providing with the room_id of the recipient to the roomId($roomId) method like shown in the above example or add a routeNotificationForChatwork() method in your notifiable model:, (*12)

...
/**
 * Route notifications for the Chatwork channel.
 *
 * @return int
 */
public function routeNotificationForChatwork()
{
    return '99999999'; // Chatwork Room ID
}
...

Available Message methods

Message(ChatworkMessage)

  • roomId('roomId'): (integer|string) Chatwork Room ID.
  • to('accountId'): (integer|string) .
  • message('message'): (string) Chat message.

Information(ChatworkInformation)

  • roomId('roomId'): (integer|string) Chatwork Room ID.
  • informationTitle('title'): (string) Information Box Title.
  • informationMessage('message'): (string) Information Box Message.

Changelog

Please see CHANGELOG for more information what has changed recently., (*13)

Testing

bash $ composer test, (*14)

Security

If you discover any security related issues, please email kaneko@e2info.com instead of using the issue tracker., (*15)

Contributing

Please see CONTRIBUTING for details., (*16)

Credits

License

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

The Versions

23/12 2017

v2.x-dev

2.9999999.9999999.9999999-dev https://github.com/kawax/laravel-notification-chatwork/

Chatwork notifications channel for Laravel. (v2)

  Sources   Download

MIT

The Requires

 

The Development Requires

by kawax

laravel notification chatwork

23/12 2017
23/12 2017