PHPackages                             mikolaykorniat/desk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. mikolaykorniat/desk-php

AbandonedLibrary[HTTP &amp; Networking](/categories/http)

mikolaykorniat/desk-php
=======================

PHP client for Desk.com v2 API based on Guzzle (Forked from bradfeehan/desk-php)

v1.6.0(8y ago)02.6kMITPHPPHP &gt;=5.3

Since May 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/MikolayKorniat/desk-php)[ Packagist](https://packagist.org/packages/mikolaykorniat/desk-php)[ RSS](/packages/mikolaykorniat-desk-php/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (7)Versions (13)Used By (0)

desk-php
========

[](#desk-php)

[![Build Status](https://camo.githubusercontent.com/95e997e938bcd6aaf4ba24aad6640b6ea80d30c155b12eb27a571d76cd5c02d2/68747470733a2f2f7472617669732d63692e6f72672f6272616466656568616e2f6465736b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bradfeehan/desk-php)[![Coverage Status](https://camo.githubusercontent.com/17db1b33b521219730958e123abd38550c3585803ca71336e4292b741a104287/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6272616466656568616e2f6465736b2d7068702f62616467652e706e67)](https://coveralls.io/r/bradfeehan/desk-php)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/b9710cc8f38486a98468f8132531437c331f2cfa40d5f0833c001ae541bf5cf1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272616466656568616e2f6465736b2d7068702f6261646765732f7175616c6974792d73636f72652e706e673f733d61646236333133326536373863373064326332336464363463623166646539623964636435333138)](https://scrutinizer-ci.com/g/bradfeehan/desk-php/)[![Dependency Status](https://camo.githubusercontent.com/77be8f423a51c2ca380e250f86740038b0e8773160ad8412fb0498df68b2bfe0/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3531613662656136666134663364303030323030343333352f62616467652e706e67)](https://www.versioneye.com/user/projects/51a6bea6fa4f3d0002004335)

PHP client for [Desk.com](http://desk.com) v2 API, based on [Guzzle](http://guzzlephp.org)

This project is still under development and things may change quickly. It'll attempt to adhere to [Semantic Versioning](http://semver.org) to minimise any issues.

Here's a summary of what's implemented:

- Main resource operations (ListCases, etc)
    - [Show](https://github.com/bradfeehan/desk-php/issues/5)
    - [List](https://github.com/bradfeehan/desk-php/issues/3)
    - [Create](https://github.com/bradfeehan/desk-php/issues/8)
    - [Update](https://github.com/bradfeehan/desk-php/issues/11)
    - [Delete](https://github.com/bradfeehan/desk-php/issues/13)
    - [Search](https://github.com/bradfeehan/desk-php/issues/15)
- Sub-item operations (ListCaseNotes, etc)
    - [Show](https://github.com/bradfeehan/desk-php/issues/6)
    - [List](https://github.com/bradfeehan/desk-php/issues/4)
    - [Create](https://github.com/bradfeehan/desk-php/issues/9)
    - [Update](https://github.com/bradfeehan/desk-php/issues/12)
    - [Delete](https://github.com/bradfeehan/desk-php/issues/14)
- Data type filtering
    - Dates
    - Custom fields?
    - Resource property lists (e.g. customer email addresses, etc)
- Resource relationships (links/embedding)
    - Links to other resources return commands
    - Embedded resources return models
    - Embedded model data type filtering

Project Aims
------------

[](#project-aims)

- Support all API operations [documented by Desk](http://dev.desk.com/API/using-the-api/#general)
- Consumption of the API's provided [relationship](http://dev.desk.com/API/using-the-api/#relationships)functionality
    - Resources link to other related resources
    - These can be embedded to reduce the number of requests
- PHP-friendly data types (dates represented using DateTime objects, etc)
- 100% *unit* test coverage (using PHPUnit)
- Additional "use-case" tests for every individual operation, which use documented responses as mock responses

Installation
------------

[](#installation)

To get this library in to an existing project, the best way is to use [Composer](http://getcomposer.org).

1. Add `bradfeehan/desk-php` as a Composer dependency in your project's [`composer.json`](http://getcomposer.org/doc/01-basic-usage.md#the-require-key "More on the composer.json format") file:

    ```
    {
        "require": {
            "bradfeehan/desk-php": "dev-master"
        }
    }
    ```
2. If you haven't already, download and [install Composer](http://getcomposer.org/doc/01-basic-usage.md#installation "More detailed installation instructions on the Composer site"):

    ```
    $ curl -sS https://getcomposer.org/installer | php
    ```
3. [Install your Composer dependencies](http://getcomposer.org/doc/01-basic-usage.md#installing-dependencies "More detailed instructions on the Composer site"):

    ```
    $ php composer.phar install
    ```
4. Set up [Composer's autoloader](http://getcomposer.org/doc/01-basic-usage.md#autoloading "More information about the autoloader on the Composer site"):

    ```
    require_once 'vendor/autoload.php';
    ```

You're done! Now the `Desk` namespace should exist and contain everything you need to consume the Desk.com API.

Super Quick Run-down
--------------------

[](#super-quick-run-down)

```
use Desk\Client;

$client = Client::factory(array(
    'subdomain' => 'foo',
    'username' => 'myuser',
    'password' => 'secret',
));

foreach ($client->getIterator("ListUsers") as $user) {
    // do things with $user

    $casesForCurrentUser = $user->getLink("cases")->execute();
}
```

Basic Usage
-----------

[](#basic-usage)

The main point of entry for your app will usually be the `Desk\Client` class:

```
$client = \Desk\Client::factory(array(
    'subdomain' => 'foo',
    'username' => 'myuser',
    'password' => 'secret',
));
```

.. or with API keys:

```
$client = \Desk\Client::factory(array(
    'subdomain' => 'foo'
    'consumer_key' => 'key',
    'consumer_secret' => 'secret',
    'token' => 'key',
    'token_secret' => 'secret',
));
```

Individual commands can be retrieved from the client and executed:

```
$command = $client->getCommand('ShowUser');
$command->set('id', 1);
$user = $command->execute();
print $user->get('name');
// => 'John Doe'
```

There are some shortcuts which can be taken. The above is equivalent to:

```
$command = $client->getCommand('ShowUser', array('id' => 1));
$user = $command->execute();
print $user->get('name');
// => 'John Doe'
```

...which again is the same as:

```
$user = $client->ShowUser(array('id' => 1));
print $user->get('name');
// => 'John Doe'
```

Complex data types are (generally) converted to/from easier to use formats. For example, dates are represented as strings over the wire when communicating with the Desk API, but these will be converted to PHP `DateTime` objects upon retrieval:

```
$customer = $client->ShowCustomer(array('id' => 1));
var_dump($customer->get('created_at'));
// => object(DateTime)#209 (3) { ...
```

### Command names

[](#command-names)

The names of commands follow a strict naming convention. The type of operation is first; this is usually one of *Show*, *List*, *Create*, *Update*, *Delete*, or *Search*. This is combined with the resource name (CamelCase if it's more than one word) -- for example, *Article*, *Company*, *CustomField* etc. *List* and *Search* operations will have a pluralised version of the resource name (e.g. *ListCompanies*, *SearchArticles*, etc). while the other operations will have the singular form (e.g. *ShowCompany*, *CreateArticle*, etc). The complete list is in the service description file, [desk.json](https://github.com/bradfeehan/desk-php/blob/master/lib/Desk/Client/desk.json "View this file on GitHub"), although it might be a bit hard to use for this purpose due to its length.

### Relationships

[](#relationships)

In version 2 of the Desk API, there exists the concept of relationships between resources. For example, a Case resource now links to the Customer resource which created the case. This is fully supported by this library.

#### Links

[](#links)

A link from one resource to another is represented by a pre-configured command object which is ready to retrieve the target of the link. To retrieve a command representing a link, call the `getLink()` method on the model:

```
$case = $client->ShowCase(array('id' => 1));
$command = $case->getLink('customer');

print $command->getName();
// => 'ShowCustomer'

print $command->get('id');
// => 1

$customer = $command->execute();

// or, more useful:
$customer = $case->getLink('customer')->execute();
```

#### Embedded Resources

[](#embedded-resources)

The example above would require two requests -- one for the case, and another for the customer. If, at the time of the first request, you know that you will (or might) need to access a related resource, you can request that the related resource be embedded into the first response. As an example, to improve on the performance of the previous example:

```
$case = $client->ShowCase(array('id' => 1, 'embed' => array('customer')));
$customer = $case->getEmbedded('customer'); // no second request necessary
```

The call to `getEmbedded()` would throw an exception if we hadn't requested the "customer" relation to be embedded at the time of the original request to retrieve the case.

Contributing
------------

[](#contributing)

Contributions are most welcome! At this early stage of development, I'm working hard on the items at the top of this README. At any time I'm probably halfway through implementing (or re-implementing) something on that list, so keep that in mind if you're planning to start working on something -- I may already be on it.

Here's a few guidelines when coding on this project:

- I'm trying to use best practices everywhere in this project. Hacky solutions are generally rejected in favor of "doing it right" (in general).
- Stick to PSR-2 coding style. This involves many things I wasn't aware of when starting out! (e.g. one argument per line in multi-line function definitions)
- Try and stick to 72/80 characters where possible (except in `.json`files if necessary).

With that being said, I feel like even if you have some code in a fork which doesn't adhere to these guidelines, it could certainly still be useful, so feel free to open a pull request anyway.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 95.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~187 days

Recently: every ~324 days

Total

8

Last Release

3077d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2cedc7cc6a9e6f1cb1b4d13d1454b8395dfd1389fe3fb37b5878c8fba3cce070?d=identicon)[MykolaiKorniat](/maintainers/MykolaiKorniat)

---

Top Contributors

[![bradfeehan](https://avatars.githubusercontent.com/u/1052806?v=4)](https://github.com/bradfeehan "bradfeehan (250 commits)")[![heston](https://avatars.githubusercontent.com/u/135492?v=4)](https://github.com/heston "heston (3 commits)")[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (3 commits)")[![MykolaiKorniat](https://avatars.githubusercontent.com/u/18246109?v=4)](https://github.com/MykolaiKorniat "MykolaiKorniat (3 commits)")[![pilot](https://avatars.githubusercontent.com/u/28564?v=4)](https://github.com/pilot "pilot (1 commits)")[![benkr94](https://avatars.githubusercontent.com/u/6446255?v=4)](https://github.com/benkr94 "benkr94 (1 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")

---

Tags

apiGuzzledeskassistlydesk.comassistly.com

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mikolaykorniat-desk-php/health.svg)

```
[![Health](https://phpackages.com/badges/mikolaykorniat-desk-php/health.svg)](https://phpackages.com/packages/mikolaykorniat-desk-php)
```

###  Alternatives

[bradfeehan/desk-php

PHP client for Desk.com v2 API based on Guzzle

2181.4k](/packages/bradfeehan-desk-php)[cossou/trak-io-api-client

PHP Trak.io Api Client built on Guzzle

204.0k](/packages/cossou-trak-io-api-client)[antoinelemaire/aircall-php

Aircall API client built on top of Guzzle 6

1049.6k](/packages/antoinelemaire-aircall-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
