eduard9969/clickup-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eduard9969/clickup-php

最新稳定版本:v1.1.3

Composer 安装命令:

composer require eduard9969/clickup-php

包简介

Fork ClickUp API client (unofficial)

README 文档

README

Fork for the original repo clickup-php | Author: howyi

A simple wrapper for ClickUp API (v1-BETA).

Fork difference:

  • Api update to version 2 (in progress)
  • Add retries when rate limit is reached (done, thanks @osiset)
  • Add tmp cache for identical requests in a short time (in the plans)

Table of Contents

Installation

composer require eduard9969/clickup-php

The package is in development status. I don't want to add another copy of the fork to https://packagist.org/

Also, You can install the package using VSC in your composer.json. Add the following code:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/Eduard9969/clickup-php.git"
    }
]

Usage

Generate client

// create Option (required: API_TOKEN)
$options = new ClickUp\Options('API_TOKEN');

// create Client (required: ClickUp\Options)
$client = new ClickUp\Client($options);

Get

// 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

You can use tasks and task methods on the any level ($team->tasks(); $space->tasks(); $folder->tasks(); etc). But remember, 100 is the maximum number of items in the response (not actual for chunk method), I recommend refining the research area.

Create

/**
 * 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']);

Update

/**
 * update task list
 * @see https://jsapi.apiary.io/apis/clickup20/reference/0/lists/update-list.html
 */
$taskList->edit(['name' => 'renamed task list']);

/**
 * update task
 * @see https://jsapi.apiary.io/apis/clickup20/reference/0/lists/update-list.html
 */
$task->edit(['name' => 'renamed task']);

Storage

By default retries when rate limit is reached execute via Memory::Class. You can use other storage (Implement the StateStorage interface) and use custom time deferrer (Implement the TimeDeferrer interface).

// create Option (required: API_TOKEN)
$options = new ClickUp\Options('API_TOKEN');

// create StoreOptions (optional: StateStorage, StateStorage, TimeDeferrer)
$storeOptions = new ClickUp\StoreOptions($redisTStorage, $redisLStorage, $timeDeferrer);

// create Client (required: ClickUp\Options, optional: ClickUp\StoreOptions)
$client = new ClickUp\Client($options, $storeOptions);

LICENSE

This project is released under the MIT license.

eduard9969/clickup-php 适用场景与选型建议

eduard9969/clickup-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 958 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「ClickUp」 「click-up」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 eduard9969/clickup-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 eduard9969/clickup-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 eduard9969/clickup-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 958
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 32
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-28