mpclarkson / freshdesk-bundle
Freshdesk API(v2)的Symfony扩展包
0.3.0
2016-08-24 03:19 UTC
Requires
- mpclarkson/freshdesk-php-sdk: 0.3.*
Requires (Dev)
- phpunit/phpunit: ~4
- symfony/framework-bundle: ~2.3
This package is auto-updated.
Last update: 2024-09-20 06:29:41 UTC
README
这是一个用于通过freshdesk-php-sdk与Freshdesk API v2交互的Symfony2-3扩展包。
需求
- Symfony 2.8+
- PHP 5.5+
- 一个Freshdesk账户
安装
要将此扩展包添加到您的Symfony应用中,请使用Composer。
将mpclarkson/freshdesk-bundle
添加到您的composer.json
文件中
{ "require": { "mpclarkson/freshdesk-bundle": "dev-master" } }
在AppKernel.php
中将扩展包添加到其中
public function registerBundles() { $bundles = array( // ... new Mpclarkson\FreshdeskBundle\FreshdeskBundle(), // ... ); }
在config.yml
中配置扩展包
freshdesk: api_key: your_freshdesk__api_key domain: your_freshdesk_domain
然后运行composer update
。
访问Freshdesk API
在控制器中,您可以按如下方式访问Freshdesk客户端和API资源
$api = $this->get('freshdesk'); //Contacts $contacts = $api->contacts->update($contactId, $data); //Agents $me = $api->agents->current(); //Companies $company = $api->companies->create($data); //Groups $deleted = $api->groups->delete($groupId); //Tickets $ticket = $api->tickets->view($filters); //Time Entries $time = $api->timeEntries->all($ticket['id']); //Conversations $ticket = $api->conversations->note($ticketId, $data); //Categories $newCategory = $api->categories->create($data); //Forums $forum = $api->forums->create($categoryId, $data); //Topics $topics = $api->topics->monitor($topicId, $userId); //Comments $comment = $api->comments->create($forumId); //Email Configs $configs = $api->emailConfigs->all(); //Products $product = $api->products->view($productId); //Business Hours $hours = $api->businessHours->all(); //SLA Policy $policies = $api->slaPolicies-all();
筛选
所有GET
请求都接受一个可选的array $query
参数来筛选结果。例如
//Page 2 with 50 results per page $page2 = $this->forums->all(['page' => 2, 'per_page' => 50]); //Tickets for a specific customer $tickets = $this->tickets->view(['company_id' => $companyId]);
请参阅Freshdesk文档以获取有关筛选GET
请求的更多信息。
贡献
这是一个正在进行中的项目,欢迎提交PR。请阅读贡献指南。
作者
此库由来自Hilenium的Matthew Clarkson编写和维护。