1. Go to this page and download the library: Download eduard9969/clickup-php 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/ */
// me
$client->user();
// -> \ClickUp\Objects\User
// all affiliated teams
$client->teams()->objects();
// -> \ClickUp\Objects\Team[]
// team by team id
$team = $client->team($teamId);
// team by name
$team = $client->teams()->getByName('team_name');
// -> \ClickUp\Objects\Team
// spaces in team
$team->spaces()->objects();
// -> \ClickUp\Objects\Space[]
// space by space id
$space = $team->space(888);
// space by name
$space = $team->spaces()->getByName('spaaaaace');
// -> \ClickUp\Objects\Space
// folders in space
$space->folders()->objects();
// -> \ClickUp\Objects\Folder[]
// folder by folder id
$folder = $space->folder(11111);
// folder by name
$folder = $space->folders()->getByName('super cool folder');
// -> \ClickUp\Objects\Folder
// lists in folder
$folder->taskLists()->objects();
// -> \ClickUp\Objects\TaskList[]
// list by list id
$taskList = $folder->taskList(9999);
// list by name
$taskList = $folder->taskLists()->getByName('T A S K L I S T');
// -> \ClickUp\Objects\TaskList
// tasks by list
// @see https://jsapi.apiary.io/apis/clickup20/reference/0/lists/update-list.html
$tasks = $taskList->tasks()->objects();
// -> \ClickUp\Objects\Task[]
// task by task id
$task = $taskList->task(3333);
// -> \ClickUp\Objects\Task
// all tasks with chunks
// tasksChunk get all tasks from the API and execute callback function (arg: $tasks->objects())
$allTasks = [];
$team->tasksChunk(false, false, function($tasks) use (&$allTasks) {
$allTasks = array_merge($tasks, $allTasks);
// return false; // break loop
});
// -> true \ false
/**
* create task list in folder
* @see https://jsapi.apiary.io/apis/clickup20/reference/0/lists/create-list.html
* @see https://jsapi.apiary.io/apis/clickup20/reference/0/lists/create-folderless-list.html
*/
$folder->createTaskList(['name' => 'newTaskList']);
/**
* create task in list
* @see https://jsapi.apiary.io/apis/clickup20/reference/0/tasks/create-task.html
*/
$taskList->createTask(['name' => 'my second task']);