PHP SDK for the Freshdesk API (v2)

v1.0.0 2019-06-21 07:43 UTC

This package is auto-updated.

Last update: 2023-03-09 21:09:27 UTC


Build Status Packagist

NOTE: This library is forked from mpclarkson/freshdesk-php-sdk, since the origin is not supported anymore.

This is a PHP SDK for the Freshdesk API v2.

If you have questions, please contact us or open an issue on GitHub.

Quick Start

require __DIR__ . '/vendor/autoload.php';
use Freshdesk\Api;

$api = new Api("your_freshdesk_api_key", "your_freshdesk_domain");

$all = $api->tickets->all();
$some = $api->tickets->all(['page' => 2]);
$new = $api->tickets->create($data);
$updated = $api->tickets->update($data);
$existing = $api->tickets->view($id);

//Responses are simple arrays, e.g.:
$id = $existing['id'];
$first = $all[0];


To integrate this library into your application, use Composer.

Add alleotech/freshdesk-php-sdk to your composer.json file:

    "require": {
        "alleotech/freshdesk-php-sdk": "dev-master"

Then run:

php composer.phar install

API Overview

Full documentation is available here

Getting started

Creating a new API instance is very easy. All you need is your Freshdesk API key and your Freshdesk domain.

require __DIR__ . '/vendor/autoload.php';
use Freshdesk\Api;

$api = new Api("your_freshdesk_api_key", "your_freshdesk_domain");


The available methods for each resource are available via a public property on the api, for example:

$contacts = $api->contacts->update($contactId, $data);

$me = $api->agents->current();

$company = $api->companies->create($data);

$deleted = $api->groups->delete($groupId);

$ticket = $api->tickets->view($filters);

//Time Entries
$time = $api->timeEntries->all($ticket['id']);

$ticket = $api->conversations->note($ticketId, $data);

$newCategory = $api->categories->create($data);

$forum = $api->forums->create($categoryId, $data);

$topics = $api->topics->monitor($topicId, $userId);

$comment = $api->comments->create($forumId);

//Email Configs
$configs = $api->emailConfigs->all();

$product = $api->products->view($productId);

//Business Hours
$hours = $api->businessHours->all();

//SLA Policy
$policies = $api->slaPolicies->all();


All responses are arrays of data. Please refer to Freshdesk's documentation for further information.


All GET requests accept an optional array $query parameter to filter results. For example:

//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]);

Please read the Freshdesk documentation for further information on filtering GET requests.


This is a work in progress and PRs are welcome. Please read the contributing guide.

Nearly all api calls are available except for the Solutions and Surveys, which Freshdesk has not yet implemented.

  • Solutions
  • Surveys
  • Uploading files is not yet supported
  • More tests. You can never have enough!
  • Nicer documentation


The library was written and maintained by Matthew Clarkson from Hilenium.

All new versions are maintedin by AlleoTech Ltd.