PHPackages                             intelogie/zendesk\_api\_client\_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. [API Development](/categories/api)
4. /
5. intelogie/zendesk\_api\_client\_php

ActiveLibrary[API Development](/categories/api)

intelogie/zendesk\_api\_client\_php
===================================

PHP Client for Zendesk REST API. See http://developer.zendesk.com/api-docs

v2.0.8(10y ago)084Apache License Version 2.0PHPPHP &gt;=5.5.0

Since Aug 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/INTELOGIE/zendesk_api_client_php)[ Packagist](https://packagist.org/packages/intelogie/zendesk_api_client_php)[ Docs](https://github.com/zendesk/zendesk_api_client_php)[ RSS](/packages/intelogie-zendesk-api-client-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (25)Used By (0)

Zendesk PHP API Client Library
==============================

[](#zendesk-php-api-client-library)

[![Build Status](https://camo.githubusercontent.com/dd2520e4f067fc40438cc9f295fd571c3a7b06aa7b554e1c9042aae579f5e576/68747470733a2f2f7472617669732d63692e6f72672f7a656e6465736b2f7a656e6465736b5f6170695f636c69656e745f7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zendesk/zendesk_api_client_php)[![Code Climate](https://camo.githubusercontent.com/3b2a6ad5347d00ce099db6074f64a6c62cf5667ccc8fdfc9e73a4bf2bec6a611/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7a656e6465736b2f7a656e6465736b5f6170695f636c69656e745f7068702f6261646765732f6770612e737667)](https://codeclimate.com/github/zendesk/zendesk_api_client_php)

API Client Version
------------------

[](#api-client-version)

This is the second version of our PHP API client. The previous version of the API client can be found on the [v1 branch](https://github.com/zendesk/zendesk_api_client_php/tree/v1).

API version support
-------------------

[](#api-version-support)

This client **only** supports Zendesk's API v2. Please see our [API documentation](http://developer.zendesk.com) for more information.

Requirements
------------

[](#requirements)

- PHP 5.5+

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

[](#installation)

The Zendesk PHP API client can be installed using [Composer](https://packagist.org/packages/zendesk/zendesk_api_client_php).

### Composer

[](#composer)

Inside of `composer.json` specify the following:

```
{
  "require": {
    "zendesk/zendesk_api_client_php": "dev-master"
  }
}
```

### Upgrading from V1 to V2

[](#upgrading-from-v1-to-v2)

If you are upgrading from [v1](https://github.com/zendesk/zendesk_api_client_php/tree/v1) of the client, we've written an [upgrade guide](https://github.com/zendesk/zendesk_api_client_php/wiki/Upgrading-from-v1-to-v2) to highlight some of the key differences.

Configuration
-------------

[](#configuration)

Configuration is done through an instance of `Zendesk\API\HttpClient`. The block is mandatory and if not passed, an error will be thrown.

```
// load Composer
require 'vendor/autoload.php';

use Zendesk\API\HttpClient as ZendeskAPI;

$subdomain = "subdomain";
$username  = "email@company.com";
$token     = "6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv"; // replace this with your token

$client = new ZendeskAPI($subdomain, $username);
$client->setAuth('basic', ['username' => $username, 'token' => $token]);
```

Usage
-----

[](#usage)

### Basic Operations

[](#basic-operations)

```
// Get all tickets
$tickets = $client->tickets()->findAll();
print_r($tickets);

// Create a new ticket
$newTicket = $client->tickets()->create([
    'subject'  => 'The quick brown fox jumps over the lazy dog',
    'comment'  => [
        'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
                  'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
    ],
    'priority' => 'normal'
]);
print_r($newTicket);

// Update a ticket
$client->tickets()->update(123,[
    'priority' => 'high'
]);

// Delete a ticket
$client->tickets()->delete(123);
```

### Attachments

[](#attachments)

```
$attachment = $client->attachments()->upload([
    'file' => getcwd().'/tests/assets/UK.png',
    'type' => 'image/png',
    'name' => 'UK.png' // Optional parameter, will default to filename.ext
]);
```

### Test suite

[](#test-suite)

The test suite is run via phpunit. Note that these are all live tests that must be run targeted at a real Zendesk instance. Credentials can be provided by setting the environment variables in phpunit.xml; a sample is provided at phpunit.xml.dist.

To run the unit tests: `vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"`

To run the live tests: `vendor/bin/phpunit --testsuite "Zendesk API Live Test Suites"`

### Side-loading

[](#side-loading)

Side-loading allows you to retrieve related records as part of a single request. See \[the documentation\] for more information. ([https://developer.zendesk.com/rest\_api/docs/core/side\_loading](https://developer.zendesk.com/rest_api/docs/core/side_loading)).

An example of sideloading with the client is shown below.

```
$tickets = $client->tickets()->sideload(['users', 'groups'])->findAll();
```

### Pagination

[](#pagination)

The Zendesk API offers a way to get the next pages for the requests and is documented in [the Zendesk Deveoloper Documentation](https://developer.zendesk.com/rest_api/docs/core/introduction#pagination).

The way to do this is to pass it as an option to your request.

```
$tickets = $this->client->tickets()->findAll(['per_page' => 10, 'page' => 2]);
```

The allowed options are

- per\_page
- page
- sort\_order

Coding Standard
---------------

[](#coding-standard)

This project strictly follows the [PSR-2](http://www.php-fig.org/psr/psr-2/) coding standard.

[PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) is used to verify that the standard is being followed.

In addition to the PSR2 standard which we try to follow the following rules as much as possible:

### PHPDoc

[](#phpdoc)

All Classes, Class Methods and Properties should have docblocs.

#### Classes

[](#classes)

Class docblocks should contain:

- A short description of the class
- Any methods available that are called via magic method with what that method returns.

A good example is

```
/**
 * Client class, base level access
 *
 * @method Debug debug()
 * @method Tickets ticket()
 * @method Views views()
 */
```

#### Methods

[](#methods)

Method docblocks should contain:

- A short description of what the method does.
- The parameters passed with what type to expect.
- Description of the parameters passed with examples(optional).
- The type of the return.
- All the possible exceptions the method may throw.

A good example of this is

```
/**
 * Find a specific ticket by id or series of ids
 *
 * @param integer|null $id
 * @param array        $queryParams
 *
 * @return Array
 *
 * @throws MissingParametersException
 * @throws \Exception
 */
```

#### Properties

[](#properties)

Class properties docblocs should contain:

- A short description of the property (optional)
- The var type

A good example of this

```
/**
 * This contains the Auth object to be used for authenticating with the Client
 *
 * @var Zendesk\API\Utilities\Auth
 */
```

### Arrays

[](#arrays)

The short notations for declaring arrays (`[]`) is preferred over the longer `array()`.

Align `=>`s following the longest key to make the arrays easier to read.

```
[
    'findAll'             => "users/{userId}/{$this->resourceName}.json",
    'find'                => "users/{userId}/{$this->resourceName}/{id}.json",
    'update'              => "users/{userId}/{$this->resourceName}/{id}.json",
    'makePrimary'         => "users/{userId}/{$this->resourceName}/{id}/make_primary.json",
    'verify'              => "users/{userId}/{$this->resourceName}/{id}/verify.json",
    'requestVerification' => "users/{userId}/{$this->resourceName}/{id}/request_verification.json",
    'delete'              => "users/{userId}/{$this->resourceName}/{id}.json",
    'create'              => "users/{userId}/{$this->resourceName}.json",
    'createAsEndUser'     => "end_users/{userId}/{$this->resourceName}.json",
]
```

### Grouped assignment statements

[](#grouped-assignment-statements)

Align the `=` for grouped assignment statements.

```
$headers             = 'sample';
$lastRequestBody     = 'example';
$lastResponseCode    = 'something';
$lastResponseHeaders = 'test';
$lastResponseError   = 'test2';
```

### Traits

[](#traits)

#### Declaration

[](#declaration)

- Traits are added after class constants and arranged alphabetically when declared.
- Group traits accordingly by adding a new line after each group.
- Groups are ordered as follows:

1. Instantiator
2. Single resource
3. Bulk traits

#### Resource Traits

[](#resource-traits)

When adding a resource, use traits to define available API calls. Resource traits are namespaced under `Zendesk\API\Traits\Resource`.

**Single Resource**

- Create
- Delete
- Find
- FindAll
- Update
- Defaults - this adds **Find**, **FindAll**, **Create**, **Update**, and **Delete**

**Bulk traits**

- CreateMany
- DeleteMany
- FindMany
- UpdateMany
- CreateOrUpdateMany

#### Utility Traits

[](#utility-traits)

Use `Zendesk\API\Traits\Utility\InstantiatorTrait` when you want a resource to be chainable to other resources. See `Zendesk/API/Resources/Tickets.php`.

```
$this->client->tickets()->comments()->findAll();
```

Note on Patches/Pull Requests
-----------------------------

[](#note-on-patchespull-requests)

1. Fork the project.
2. Make your feature addition or bug fix.
3. Add tests for it. This is important so that we don't break your improvement in a future version unintentionally.
4. Please follow the [coding standard described above](#coding-standard).
5. Commit and do not mess with version or history. (If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when we pull)
6. Send a pull request. Bonus points for topic branches.

Copyright and license
---------------------

[](#copyright-and-license)

Copyright 2013-present Zendesk

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~36 days

Recently: every ~44 days

Total

14

Last Release

3716d ago

Major Versions

v1.x-dev → v2.x-dev2015-08-03

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.1

v2.0.3PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cd960536c07e255b2e6f7e55c03c6d09274b215ccceaccc38926ffe03e098a7?d=identicon)[bgauthier](/maintainers/bgauthier)

---

Top Contributors

[![joseconsador](https://avatars.githubusercontent.com/u/1302819?v=4)](https://github.com/joseconsador "joseconsador (172 commits)")[![miogalang](https://avatars.githubusercontent.com/u/1471573?v=4)](https://github.com/miogalang "miogalang (62 commits)")[![shanitang](https://avatars.githubusercontent.com/u/9438502?v=4)](https://github.com/shanitang "shanitang (36 commits)")[![atroche](https://avatars.githubusercontent.com/u/29839?v=4)](https://github.com/atroche "atroche (27 commits)")[![devarispbrown](https://avatars.githubusercontent.com/u/769307?v=4)](https://github.com/devarispbrown "devarispbrown (17 commits)")[![jmramos02](https://avatars.githubusercontent.com/u/3782351?v=4)](https://github.com/jmramos02 "jmramos02 (11 commits)")[![mikealmond](https://avatars.githubusercontent.com/u/600744?v=4)](https://github.com/mikealmond "mikealmond (9 commits)")[![dpawluk](https://avatars.githubusercontent.com/u/5264339?v=4)](https://github.com/dpawluk "dpawluk (7 commits)")[![andreionut](https://avatars.githubusercontent.com/u/1051275?v=4)](https://github.com/andreionut "andreionut (4 commits)")[![BDav24](https://avatars.githubusercontent.com/u/5574929?v=4)](https://github.com/BDav24 "BDav24 (3 commits)")[![ggrossman](https://avatars.githubusercontent.com/u/5636481?v=4)](https://github.com/ggrossman "ggrossman (3 commits)")[![chrisminett](https://avatars.githubusercontent.com/u/1084019?v=4)](https://github.com/chrisminett "chrisminett (3 commits)")[![antoscarface](https://avatars.githubusercontent.com/u/1921869?v=4)](https://github.com/antoscarface "antoscarface (3 commits)")[![eski009](https://avatars.githubusercontent.com/u/811807?v=4)](https://github.com/eski009 "eski009 (3 commits)")[![mbrown-lw](https://avatars.githubusercontent.com/u/243889486?v=4)](https://github.com/mbrown-lw "mbrown-lw (2 commits)")[![TheFrozenFire](https://avatars.githubusercontent.com/u/948014?v=4)](https://github.com/TheFrozenFire "TheFrozenFire (1 commits)")[![bgauthier](https://avatars.githubusercontent.com/u/1789355?v=4)](https://github.com/bgauthier "bgauthier (1 commits)")[![danielstjules](https://avatars.githubusercontent.com/u/817212?v=4)](https://github.com/danielstjules "danielstjules (1 commits)")[![d-ph](https://avatars.githubusercontent.com/u/4347095?v=4)](https://github.com/d-ph "d-ph (1 commits)")[![gdespirito](https://avatars.githubusercontent.com/u/1103494?v=4)](https://github.com/gdespirito "gdespirito (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/intelogie-zendesk-api-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/intelogie-zendesk-api-client-php/health.svg)](https://phpackages.com/packages/intelogie-zendesk-api-client-php)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M964](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1933.1k5](/packages/aimeos-prisma)

PHPackages © 2026

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