Git Product home page Git Product logo

freshdesk-php-sdk's Introduction

Freshdesk PHP SDK API v2

Build Status Scrutinizer Code Quality SensioLabsInsight Packagist

This is a PHP 5.5+ SDK for the Freshdesk API v2.

If you have questions, please contact me 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);
$api->tickets->delete($id);
$existing = $api->tickets->view($id);

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

Framework Integration

Installation

To integrate this library into your application, use Composer.

Installation: composer require supover/freshdesk-php-sdk

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");

Resources

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

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

Responses

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

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.

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

Author

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

Reference

freshdesk-php-sdk's People

Contributors

gielwijgergangs avatar gtapps avatar loekvangool avatar mpclarkson avatar onehatrepo avatar scrutinizer-auto-fixer avatar vdechenaux avatar vutbay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.