mpclarkson/freshdesk-bundle

Symfony bundle for the Freshdesk API (v2)

Installs: 67 952

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 2

Open Issues: 1

Type:symfony-bundle

0.3.0 2016-08-24 03:19 UTC

This package is auto-updated.

Last update: 2024-11-20 06:53:35 UTC


README

Build Status Scrutinizer Code Quality SensioLabsInsight Packagist

This is a Symfony2-3 bundle to interact with the Freshdesk API v2 via the freshdesk-php-sdk.

Requirements

  • Symfony 2.8+
  • PHP 5.5+
  • A Freshdesk account

Installation

To add this bundle to your Symfony app, use Composer.

Add mpclarkson/freshdesk-bundle to your composer.json file:

{
    "require": {
        "mpclarkson/freshdesk-bundle": "dev-master"
    }
}

Add the bundle to AppKernel.php:

public function registerBundles()
{
    $bundles = array(
        // ...
            new Mpclarkson\FreshdeskBundle\FreshdeskBundle(),
        // ...
    );
}

Configure the bundle in config.yml:

freshdesk:
    api_key: your_freshdesk__api_key
    domain: your_freshdesk_domain

Then run composer update.

Accessing the Freshdesk API

In a controller you can access the Freshdesk client and the API resources as follows:

$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();

Filtering

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.

Contributing

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

Author

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

References