mtymek/mt-zendesk-api

ZF2 module wrapper for Zendesk API

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.1.1 2016-07-12 15:30 UTC

This package is auto-updated.

Last update: 2022-02-04 22:08:39 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

Introduction

This module allows easy access of Zendesk API from within Zend Framework 2 application.

Installation

Installation is supported via Composer:

  1. Add "mtymek/mt-zendesk-api":"dev-master" to your composer.json file and run php composer.phar update.
  2. Add MtZendeskApi to your config/application.config.php file under the modules key.

Configuration

  1. Copy config/zendesk.local.php.dist file into your main application's config/autoload' directory, rename it to zendesk.local.php`
  2. Replace placeholder values with subdomain, username and API token read from Zendesk settings page

Example:

return [
    'zendesk' => [
        'subdomain' => 'mycompany',
        'username'  => 'support@mycompany.com',
        'token'     => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    ],
];

Usage

Once configured, MtZendeskApi will expose Zendesk API client using ServiceManager. Example usage (from controller):

$client = $this->getServiceLocator()->get('Zendesk\API\Client');
$newTicket = $client->tickets()->create(
    [
        'subject'   => 'Question to Support Team',
        'tags'      => ['tag1', 'tag2'],
        'requester' => [
            'email' => 'johndoe@domain.com',
        ],
        'comment'   => [
            'body' => "Ticket body"
        ],
        'priority'  => 'normal'
    ]
);