Skip to content

Cube-Solutions/MtZendeskApi

 
 

Repository files navigation

MtZendeskApi - ZF2 module wrapper for Zendesk PHP SDK

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'  => '[email protected]',
        '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' => '[email protected]',
        ],
        'comment'   => [
            'body' => "Ticket body"
        ],
        'priority'  => 'normal'
    ]
);

About

ZF2 module wrapper around Zendesk PHP SDK

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%