承接 evodelavega/freshdesk-rest 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

evodelavega/freshdesk-rest

Composer 安装命令:

composer require evodelavega/freshdesk-rest

包简介

A simple wrapper for the Freshdesk REST API. Freshdesk themselves are aware of this repo, and it is currently listed as the only third-party PHP wrapper

README 文档

README

Build Status

FreshDesk.com PHP API Wrapper

The "composer-aware edition".

Highlights

Composer, obviously, but apart from that, this feature branch offers:

  • Namespace support
  • A "Rest" class, that can be extended easily
  • Will become 100% Object Oriented (no more passing around tons of strings of data)
  • Easy integration with MVC frameworks like Zend, Symfony2

Ways To Improve

  1. Still being work in progress: separation of concern is something that needs a lot of work (being tackled in the feature/beta branch ATM)
  2. Better documentation + WIKI on how to contribute
  3. Out of the box support for filters, statuses and the like (through class-constants)
  4. Tests have been added, but they can be improved on, still

Usage

Add this repo to your composer.json file to use this repository as a direct dependency.

{ "repositories": [ { "type": "vcs", "url": "https://github.com/EVODelavega/freshdesk-rest.git" } ], "require": { "EVODelavega/freshdesk-rest": "dev-master" } }

This package has been added to packagist, too. Packagist only accepts lower-case package names, so simply adding the following will work:

{ "require": { "evodelavega/freshdesk-rest": "dev-master" } }

If you are going to use this wrapper to create new tickets in freshdesk, there is a postUpdate/postInstall script you can use to set the cc-email constant in the Freshdesk\Model\Ticket class. To automatically configure this constant, add the following to your scripts section in the composer.json file (Note: This feature is deprecated):

"scripts": { "post-install-cmd": [ "Freshdesk\\Config\\Composer::postUpdate" ], "post-update-cmd": [ "Freshdesk\\Config\\Composer::postUpdate" ] }

Example usage (taken from the example.php file)

<?php use Freshdesk\Config\Connection, Freshdesk\Rest;// for backwards compatibility with existing code, use alias: use Freshdesk\Rest as FreshdeskRest; $fd = new Rest( new Connection( 'https://<user>:<password>@<domain>' ) ); $apiExample = new Rest( new Connection( 'http://<API_KEY>:X@<domain>' ) );

Notes

This code follows the coding standards as layed out by the PHP-FIG, with some Symfony2 style sprinkled on top. Exceptions' messages are returned by the sprintf and vsprintf functions, for example.

I have, however, granted myself one guilty pleasure: The entire code-base uses Allman-style indentation.

##Contributing Any contributions are, of course, greatly appreciated. If you wish to contribute, a couple of things to keep in mind

  1. Adding support for certain API calls that are currently missing is done by adding the corresponding method to the appropriate child class of Freshdesk\Rest
  2. The Coding standards used throughout this code should be respected. Pull requests that do not follow the standards will not be merged
  3. Reporting an issue without a patch or PR is fine, and welcomed, but be complete in your description of the problem and/or suggested solutions
  4. Document your code as much as possible. The code we have ATM needs some more documentation as it is. Adding code that is un-documented will only increase the problem...
  5. Use the data models (Freshdesk\Model namespace) wherever you can. The goal of this API is to offer a clear & safe interface, type-hints are a vital part of this.

As an illustration: initially, deleting and assigning tickets was not supported by this wrapper. Users had to either extend the Freshdesk\Ticket class themselves, or create a new child of Freshdesk\Rest, and write their own methods. This issue has been addressed as follows:

  • Create a feature/delete-ticket branch
  • Add methods to Freshdesk\Ticket, as deleting, restoring and assigning tickets is clearly a matter for the Ticket API class
  • Modify the Freshdesk\Model\Ticket class accordingly (adding responderId and deleted properties, each with their getter and setter methods)
  • Update the example.php file to demonstrate the usage for the new methods
  • Test the code (once the feature/tests branch is merged, provide unit-tests)
  • commit & merge

The reasons why changes like this have to go in the appropriate child of Freshdesk\Rest are twofold. Even though the methods need little else than a ticket id (and in the case of assignTicket, a responderId aswell), this approach forces users into using the data models. This, in turn, enables type-hinting for easier debugging and guaranteed value checking. Another advantage is that objects are passed aroudn as references, which means that passing an object to a method means that all variables, regardless of scope, will reference the most up-to-date instance of the object, and therefore, the data is far more likely to be accurate.

A quick example for completeness, and in order to convince the sceptics:

 public function someMethod() { $db = new PDO($dsn, $usr, $pass, $options); $stmt = $db->prepare('SELECT ticketId FROM helpdesk.tickets WHERE clientId = :cid AND status = :status'); $stmt->execute([':cid' => 1, ':status' => \Freshdesk\Model\Ticket::STATUS_PENDING]); $row = $stmt->fetch(PDO::FETCH_OBJ); $ticket = new \Freshdesk\Model\Ticket(['displayId' => $row->ticketId]);//create instance //...more code $anotherObject->setTicket($ticket); //...some more calls, possibly in another method: $api = new \Freshdesk\Ticket( new \Freshdesk\Config\Connection( 'https://<api-key>:X@<domain>' ) ); //complete the ticket via the API $api->getFullTicket($ticket); //...more code $anotherObject->getTicket();//<-- returns the updated ticket model }

In this case, the ticket instance is being used on various places. Because the entire API uses data models, we can save on expensive API calls, because each property and/or variable references a single instance.

evodelavega/freshdesk-rest 适用场景与选型建议

evodelavega/freshdesk-rest 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88.93k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 evodelavega/freshdesk-rest 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 88.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2026-01-04