PHP code example of nexus4812 / php-chatwork-client
1. Go to this page and download the library: Download nexus4812/php-chatwork-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nexus4812 / php-chatwork-client example snippets
$chatwork = Nexus\ChatworkClient\Api\Chatwork::create('## Your API Token ##');
// 自分の情報を取得する
$me = $chatwork->me()->getMe();
echo($me->room_id); // 322
echo($me->name); // Nexus
echo($me->avatar_image_url); // https://example.com/abc.png
// タスク期限が明日のタスクを抽出する
$tomorrow = Carbon::Today()->addDay();
$tasks = $chatwork->myTask()->getTasks()->filter(function (Task $task) {
// タイムスタンプはすべてCarbonで取得できます
return $tomorrow->isSameDay($task->limitTime());
});
$tasks->each(function (Task $task) {
echo($task->room->name); // 営業運用チームチャット
echo($task->body); // A社の提案資料作成をお願いします
});