sun-asterisk/laravel-chatwork

Chatwork SDK for Laravel

v0.2.1 2021-03-05 01:27 UTC

This package is auto-updated.

Last update: 2024-12-05 10:07:11 UTC


README

Latest Stable Version

Chatwork SDK for Laravel 5, 6, 7.

Installation

Using composer:

composer require sun-asterisk/laravel-chatwork

For Laravel 5.4 and earlier, add the service provider to your config/app.php.

'providers' => [
    // ...
    SunAsterisk\Chatwork\Laravel\ServiceProvider::class
    // ...
];

Configure

First register an API Key here. Then add the API key to your .env:

CHATWORK_API_KEY=your_api_key_here

Usage

You can use the provided facade via an alias:

use Chatwork;

$me = Chatwork::me();
$members = Chatwork::room($roomId)->members()->list();

Or use dependency injection:

use SunAsterisk\Chatwork\Chatwork;

class ChatworkCommand extends Command
{
    public function handle(Chatwork $chatwork)
    {
        $message = $chatwork->toAll()->text('Hi there');
        $chatwork->room($roomId)->messages()->create($message);
    }
}