activecollab/activecollab-feather-sdk
Composer 安装命令:
composer require activecollab/activecollab-feather-sdk
包简介
This is a simple PHP library that makes communication with Active Collab API easy
关键字:
README 文档
README
This is a simple PHP library that makes communication with ActiveCollab API easy.
Installation
If you choose to install this application with Composer instead of pulling down the git repository you will need to add a composer.json file to the location you would like to pull the repository down to featuring:
{
"require": {
"activecollab/activecollab-feather-sdk": "^3.0"
}
}
Run a composer update to install the package.
Note: If you used an older version of ActiveCollab API wrapper and loaded it using dev-master, lock it to version 2.0 by setting require statement to ^2.0 and calling composer update.
Connecting to ActiveCollab Cloud Accounts
<?php require_once '/path/to/vendor/autoload.php'; // Provide name of your company, name of the app that you are developing, your email address and password. $authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember'); // Show all ActiveCollab 5 and up account that this user has access to. print_r($authenticator->getAccounts()); // Show user details (first name, last name and avatar URL). print_r($authenticator->getUser()); // Issue a token for account #123456789. $token = $authenticator->issueToken(123456789); // Did we get it? if ($token instanceof \ActiveCollab\SDK\TokenInterface) { print $token->getUrl() . "\n"; print $token->getToken() . "\n"; } else { print "Invalid response\n"; die(); }
Connecting to Self-Hosted ActiveCollab Accounts
require_once '/path/to/vendor/autoload.php'; // Provide name of your company, name of the app that you are developing, your email address and password. Last parameter is URL where your ActiveCollab is installed. $authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https://my.company.com/projects'); // Issue a token. $token = $authenticator->issueToken(); // Did we get what we asked for? if ($token instanceof \ActiveCollab\SDK\TokenInterface) { print $token->getUrl() . "\n"; print $token->getToken() . "\n"; } else { print "Invalid response\n"; die(); }
SSL problems?
If curl complains that SSL peer verification has failed, you can turn it off like this:
// Cloud $authenticator = new \ActiveCollab\SDK\Authenticator\Cloud('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', false); $authenticator->setSslVerifyPeer(false); // Self-hosted $authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('ACME Inc', 'My Awesome Application', 'you@acmeinc.com', 'hard to guess, easy to remember', 'https://my.company.com/projects', false); $authenticator->setSslVerifyPeer(false); // Client $client = new \ActiveCollab\SDK\Client($token); $client->setSslVerifyPeer(false);
Note: Option to turn off SSL peer verification has been added in ActiveCollab SDK 3.1.
Constructing a client instance
Once we have our token, we can construct a client and make API calls:
$client = new \ActiveCollab\SDK\Client($token);
Listing all tasks in project #65 is easy. Just call:
$client->get('projects/65/tasks');
To create a task, simply send a POST request:
try { $client->post('projects/65/tasks', [ 'name' => 'This is a task name', 'assignee_id' => 48 ]); } catch(AppException $e) { print $e->getMessage() . '<br><br>'; // var_dump($e->getServerResponse()); (need more info?) }
To update a task, PUT request will be needed:
try { $client->put('projects/65/tasks/123', [ 'name' => 'Updated named' ]); } catch(AppException $e) { print $e->getMessage() . '<br><br>'; // var_dump($e->getServerResponse()); (need more info?) }
post() and put() methods can take two arguments:
command(required) - API command,variables- array of request variables (payload)
To remove a task, call:
try { $client->delete('projects/65/tasks/123'); } catch(AppException $e) { print $e->getMessage() . '<br><br>'; // var_dump($e->getServerResponse()); (need more info?) }
delete() method only requires command argument to be provided.
For full list of available API command, please check ActiveCollab API documentation.
activecollab/activecollab-feather-sdk 适用场景与选型建议
activecollab/activecollab-feather-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 93.94k 次下载、GitHub Stars 达 52, 最近一次更新时间为 2015 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「activecollab」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 activecollab/activecollab-feather-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 activecollab/activecollab-feather-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 activecollab/activecollab-feather-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library that enables easy persistance of objects to the MySQL 5.7+ database
Tag objects and collections using etag
Define database structure in PHP and let the library generate object classes and tables
Database schema migrations
Abstract interface for preparing orders and processing payments
Server side promises
统计信息
- 总下载量: 93.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 52
- 点击次数: 29
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-05