justijndepover/teamleader-api
Composer 安装命令:
composer require justijndepover/teamleader-api
包简介
PHP Client for the Teamleader API
关键字:
README 文档
README
PHP Client for the Teamleader API
Caution
This application is still in development and could implement breaking changes. Please use at your own risk.
Installation
You can install the package with composer
composer require justijndepover/teamleader-api
Installing the package in Laravel
To use the plugin in Laravel applications, please refer to the Laravel usage page
Usage
Connecting to Teamleader:
// note the state param: this can be a random string. It's used as an extra layer of protection. Teamleader will return this value when connecting. $teamleader = new Teamleader(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, STATE); // open the teamleader login header("Location: {$teamleader->redirectForAuthorizationUrl()}"); exit;
After connecting, Teamleader will send a request back to your redirect uri.
$teamleader = new Teamleader(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, STATE); if ($_GET['error']) { // your application should handle this error } if ($_GET['state'] != $teamleader->getState()) { // state value does not match, your application should handle this error } $teamleader->setAuthorizationCode($_GET['code']); $teamleader->connect(); // store these values: $accessToken = $teamleader->getAccessToken(); $refreshToken = $teamleader->getRefreshToken(); $expiresAt = $teamleader->getTokenExpiresAt();
Your application is now connected. To start fetching data:
$teamleader = new Teamleader(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, STATE); $teamleader->setAccessToken($accessToken); $teamleader->setRefreshToken($refreshToken); $teamleader->setTokenExpiresAt($expiresAt); // fetch data: $teamleader->crm->get(); // you should always store your tokens at the end of a call $accessToken = $teamleader->getAccessToken(); $refreshToken = $teamleader->getRefreshToken(); $expiresAt = $teamleader->getTokenExpiresAt();
Available methods
Note that your application should have the correct scopes enabled inside the integration
This application is in an early development stage. Therefore not all resources are available as props yet. (for example: $teamleader->users->me)
In the meantime it's possible to fetch every resource available through the get and post methods:
$teamleader->get('users.me'); $teamleader->get('departments.list'); $teamleader->get('departments.info', ['id' => $id]); $teamleader->post('contacts.add', [ // all the data ]);
Rate limiting
After each request, the rate limiting headers are available.
// returns the maximum rate limit your application can hit in 1 minute $teamleader->getRateLimitLimit(); // returns the current limit remaining $teamleader->getRateLimitRemaining(); // returns the datetime (UTC) when your application can make calls again, after hitting the rate limit. $teamleader->getRateLimitReset();
How you handle rate limiting is up to you. But the application provides a helper method to ensure you never hit the limit:
$teamleader->get('contacts.info', ['id' => $id]); // executing this function will sleep until the X-RateLimitReset header has passed, but only if the rate limit is hit. $teamleader->ensureRateLimitingIsNotExceeded();
Security
If you find any security related issues, please open an issue or contact me directly at justijndepover@gmail.com.
Contribution
If you wish to make any changes or improvements to the package, feel free to make a pull request.
License
The MIT License (MIT). Please see License File for more information.
justijndepover/teamleader-api 适用场景与选型建议
justijndepover/teamleader-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.4k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2021 年 03 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「Teamleader」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 justijndepover/teamleader-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 justijndepover/teamleader-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 justijndepover/teamleader-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP client to connect to the Teamleader API
Teamleader OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Teamleader API v2 PHP SDK
Laravel TeamLeader SDK
A PSR-7 compatible library for making CRUD API endpoints
A library to deal with VAT Numbers within Teamleader CRM
统计信息
- 总下载量: 1.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-31
