madeitbelgium/teamleader
Composer 安装命令:
composer require madeitbelgium/teamleader
包简介
Laravel TeamLeader SDK
关键字:
README 文档
README
With this Laravel package you can create a TeamLeader integration.
Installation
composer require madeitbelgium/teamleader
Or require this package in your composer.json and update composer.
"madeitbelgium/teamleader": "^1.8"
Publish config file
php artisan vendor:publish --provider="MadeITBelgium\TeamLeader\ServiceProvider\TeamLeader"
Laravel <5.5
After updating composer, add the ServiceProvider to the providers array in config/app.php
MadeITBelgium\TeamLeader\ServiceProvider\TeamLeader::class,
You can use the facade for shorter code. Add this to your aliases:
'TeamLeader' => MadeITBelgium\TeamLeader\Facade\TeamLeader::class,
Documentation
Usage
use MadeITBelgium\TeamLeader\TeamLeader; $teamLeader = new TeamLeader($appUrl, $clientId, $clientSecret, $redirectUri, $client = null);
In laravel you can use the Facade
use MadeITBelgium\TeamLeader\Facade\TeamLeader; $teamLeaderContact = TeamLeader::crm()->contact()->add([ 'first_name' => 'Tjebbe', 'last_name' => 'Lievens', 'emails' => [ [ 'type' => 'primary', 'email' => 'info@madeit.be', ] ], 'telephones' => [ ['type' => 'mobile', 'number' => '0000000000'], ], 'addresses' => [ [ 'type' => 'primary', 'address' => [ 'line_1' => 'Adres 1', 'postal_code' => '1234', 'city' => 'Cityname', 'country' => 'BE', ] ] ], 'language' => "nl", ]); $contactId = $teamLeaderContact->data->id;
Authentication
Create a redirect URL and redirect the user to the teamleader URL.
TeamLeader::setRedirectUrl($redirect_url); $redirectTo = TeamLeader::getAuthorizationUrl();
When the user succesfully is authenticated. The user is redirect to the provided redirect URL. You can now request (and save) the access and refersh token.
$accessTokenResult = TeamLeader::requestAccessToken($request->get('code')); $access_token = TeamLeader::getAccessToken(); $refresh_token = TeamLeader::getRefreshToken(); $expired_at = TeamLeader::getExpiresAt();
The access token has a short expire time. Before each reqeust check if the access token is still valid.
TeamLeader::setAccessToken($access_token); TeamLeader::setRefreshToken($refresh_token); TeamLeader::setExpiresAt($expired_at); $refresh = TeamLeader::checkAndDoRefresh(); if (false !== $refresh) { $access_token = TeamLeader::getAccessToken(); $refresh_token = TeamLeader::getRefreshToken(); $expired_at = TeamLeader::getExpiresAt(); //Save data to database }
All available endpoints
Need more endpoints? Create an issue or contact us.
TeamLeader::setRedirectUrl($redirect_url); TeamLeader::getAuthorizationUrl(); TeamLeader::requestAccessToken($code); TeamLeader::getAccessToken(); TeamLeader::getRefreshToken(); TeamLeader::getExpiresAt(); TeamLeader::setAccessToken($access_token); TeamLeader::setRefreshToken($refresh_token); TeamLeader::setExpiresAt($expired_at); TeamLeader::checkAndDoRefresh(); TeamLeader::general()->department()->list() TeamLeader::general()->department()->info($id) TeamLeader::general()->user()->me() TeamLeader::general()->user()->list() TeamLeader::general()->user()->info($id) TeamLeader::general()->team()->list() TeamLeader::general()->customField()->list() TeamLeader::general()->customField()->info($id) TeamLeader::general()->workType()->list() TeamLeader::crm()->contact()->list(['filter' => ..., 'page' => ..., 'sort' => ...]); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.list TeamLeader::crm()->contact()->info($id); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.info TeamLeader::crm()->contact()->add(['first_name' => ..., ...]); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.add TeamLeader::crm()->contact()->update($id, ['first_name' => ...]) //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.update TeamLeader::crm()->contact()->delete($id); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.delete TeamLeader::crm()->contact()->tag($id, $tags); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.tag TeamLeader::crm()->contact()->untag($id, $tags); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.untag TeamLeader::crm()->contact()->linkToCompany($id, $companyId, $position, $decisionMaker) //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.linktocompany TeamLeader::crm()->contact()->unlinkToCompany($id, $companyId); //https://developer.focus.teamleader.eu/#/reference/crm/contacts/contacts.unlinkfromcompany TeamLeader::crm()->company()->list(['filter' => ..., 'page' => ..., 'sort' => ...]); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.list TeamLeader::crm()->company()->info($id); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.info TeamLeader::crm()->company()->add(['first_name' => ..., ...]); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.add TeamLeader::crm()->company()->update($id, ['first_name' => ...]) //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.update TeamLeader::crm()->company()->delete($id); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.delete TeamLeader::crm()->company()->tag($id, $tags); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.tag TeamLeader::crm()->company()->untag($id, $tags); //https://developer.focus.teamleader.eu/#/reference/crm/companies/companies.untag TeamLeader::deals()->list($data = []); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.list TeamLeader::deals()->info($id); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.info TeamLeader::deals()->create($data); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.create TeamLeader::deals()->update($id, $data); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.update TeamLeader::deals()->move($id, $phaseId); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.move TeamLeader::deals()->win($id); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.win TeamLeader::deals()->lose($id, $reason_id = null, $extra_info = null); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.lose TeamLeader::deals()->delete($id); //https://developer.focus.teamleader.eu/#/reference/deals/deals/deals.delete TeamLeader::deals()->lostReasons($data = []); //https://developer.focus.teamleader.eu/#/reference/deals/deals/lostreasons.list TeamLeader::files()->list($data = []) TeamLeader::files()->info($id) TeamLeader::files()->download($id) TeamLeader::files()->upload($name, $subject = [], $folder = 'General') TeamLeader::files()->delete($id) TeamLeader::invoicing()->invoices()->list($data = []) TeamLeader::invoicing()->invoices()->info($id) TeamLeader::invoicing()->invoices()->draft($data) TeamLeader::invoicing()->invoices()->update($id, $data) TeamLeader::invoicing()->invoices()->delete($id) TeamLeader::invoicing()->invoices()->download($id, $format = 'pdf') TeamLeader::invoicing()->invoices()->copy($id) TeamLeader::invoicing()->invoices()->book($id, $on) TeamLeader::invoicing()->invoices()->registerPayment($id, $paid_at, $amount, $currency = 'EUR') TeamLeader::invoicing()->invoices()->credit($id, $creditNoteDate) TeamLeader::invoicing()->invoices()->creditPartially($id, $creditNoteDate, $groupedLines, $discount = []) TeamLeader::invoicing()->creditNotes()->list($data = []) TeamLeader::invoicing()->creditNotes()->info($id) TeamLeader::invoicing()->creditNotes()->download($id, $format = 'pdf') TeamLeader::invoicing()->taxRates()->list() TeamLeader::invoicing()->subscriptions()->list($data = []) TeamLeader::invoicing()->subscriptions()->info($id) TeamLeader::invoicing()->subscriptions()->create($data) TeamLeader::invoicing()->subscriptions()->update($id, $data) TeamLeader::invoicing()->subscriptions()->deactivate($id) TeamLeader::products()->product()->categoriesList($data = []) TeamLeader::products()->product()->list($data = []) TeamLeader::products()->product()->info($id) TeamLeader::products()->product()->add($data) TeamLeader::mailTemplates()->list($data = []) TeamLeader::timeTracking()->list($data = []) TeamLeader::timeTracking()->info($id) TeamLeader::timeTracking()->add($data) TeamLeader::timeTracking()->update($id, $data) TeamLeader::timeTracking()->resume($id, $data) TeamLeader::timeTracking()->delete($id) TeamLeader::milestones()->list($data = []) TeamLeader::milestones()->info($id) TeamLeader::milestones()->add($data) TeamLeader::milestones()->update($id, $data) TeamLeader::milestones()->delete($id) TeamLeader::milestones()->close($id) TeamLeader::milestones()->open($id) TeamLeader::tasks()->list($data = []) TeamLeader::tasks()->info($id) TeamLeader::tasks()->add($data) TeamLeader::tasks()->update($id, $data) TeamLeader::tasks()->delete($id) TeamLeader::tasks()->complete($id) TeamLeader::tasks()->reopen($id) TeamLeader::tasks()->schedule($id) TeamLeader::webhooks()->list(); //https://developer.focus.teamleader.eu/#/reference/other/webhooks/webhooks.list TeamLeader::webhooks()->register($data); //https://developer.focus.teamleader.eu/#/reference/other/webhooks/webhooks.register TeamLeader::webhooks()->unregister($url, $types); //https://developer.focus.teamleader.eu/#/reference/other/webhooks/webhooks.unregister
The complete documentation can be found at: http://www.madeit.be/
Support
Support github or mail: tjebbe.lievens@madeit.be
Contributing
Please try to follow the psr-2 coding style guide. http://www.php-fig.org/psr/psr-2/
License
This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!
madeitbelgium/teamleader 适用场景与选型建议
madeitbelgium/teamleader 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.01k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2018 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Teamleader」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 madeitbelgium/teamleader 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 madeitbelgium/teamleader 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 madeitbelgium/teamleader 相关的其它包
同方向 / 同关键字的高下载量 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
PHP Client for the Teamleader API
A library to deal with VAT Numbers within Teamleader CRM
Alfabank REST API integration
统计信息
- 总下载量: 13.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2018-11-21