2017 © Pedro Peláez
 

library zendesk-laravel

Laravel wrapper for zendesk/zendesk_api_client_php package

image

huddledigital/zendesk-laravel

Laravel wrapper for zendesk/zendesk_api_client_php package

  • Wednesday, June 28, 2017
  • by huddledigital
  • Repository
  • 5 Watchers
  • 49 Stars
  • 122,341 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 5 Open issues
  • 11 Versions
  • 18 % Grown

The README.md

Laravel Zendesk

This package provides integration with the Zendesk API. It supports creating tickets, retrieving and updating tickets, deleting tickets, etc., (*1)

The package simply provides a Zendesk facade that acts as a wrapper to the zendesk/zendesk_api_client_php package., (*2)

NB: Currently only supports token-based authentication., (*3)

Installation

You can install this package via Composer using:, (*4)

composer require huddledigital/zendesk-laravel

You must also install the service provider., (*5)

Laravel 5.5+ users: this step may be skipped, as the package supports auto discovery., (*6)

// config/app.php
'providers' => [
    ...
    Huddle\Zendesk\Providers\ZendeskServiceProvider::class,
    ...
];

If you want to make use of the facade you must install it as well., (*7)

// config/app.php
'aliases' => [
    ..
    'Zendesk' => Huddle\Zendesk\Facades\Zendesk::class,
];

Configuration

To publish the config file to app/config/zendesk-laravel.php run:, (*8)

php artisan vendor:publish --provider="Huddle\Zendesk\Providers\ZendeskServiceProvider"

Set your configuration using environment variables, either in your .env file or on your server's control panel:, (*9)

  • ZENDESK_SUBDOMAIN

The subdomain part of your Zendesk organisation URL., (*10)

e.g. http://huddledigital.zendesk.com use huddledigital, (*11)

  • ZENDESK_USERNAME

The username for the authenticating account., (*12)

  • ZENDESK_TOKEN

The API access token. You can create one at: https://SUBDOMAIN.zendesk.com/agent/admin/api/settings, (*13)

  • ZENDESK_DRIVER (Optional)

Set this to null or log to prevent calling the Zendesk API directly from your environment., (*14)

Usage

Facade

The Zendesk facade acts as a wrapper for an instance of the Zendesk\API\Client class. Any methods available on this class (documentation here) are available through the facade. for example:, (*15)

// Get all tickets
Zendesk::tickets()->findAll();

// Create a new ticket
Zendesk::tickets()->create([
  'subject' => 'Subject',
  'comment' => [
      'body' => 'Ticket content.'
  ],
  'priority' => 'normal'
]);

// Update multiple tickets
Zendesk::ticket([123, 456])->update([
  'status' => 'urgent'
]);

// Delete a ticket
Zendesk::ticket(123)->delete();

Dependency injection

If you'd prefer not to use the facade, you can skip adding the alias to config/app.php and instead inject Huddle\Zendesk\Services\ZendeskService into your class. You can then use all of the same methods on this object as you would on the facade., (*16)

<?php

use Huddle\Zendesk\Services\ZendeskService;

class MyClass {

    public function __construct(ZendeskService $zendesk_service) {
        $this->zendesk_service = $zendesk_service;
    }

    public function addTicket() {
        $this->zendesk_service->tickets()->create([
              'subject' => 'Subject',
              'comment' => [
                    'body' => 'Ticket content.'
              ],
              'priority' => 'normal'
        ]);
    }

}

This package is available under the MIT license., (*17)

The Versions

28/06 2017

dev-master

9999999-dev http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

28/06 2017

v2.3

2.3.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

08/05 2017

v2.2

2.2.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

13/04 2016

v2.1

2.1.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/11 2015

v2.0

2.0.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.5

1.5.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.4

1.4.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.3

1.3.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.2

1.2.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.1

1.1.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk

02/06 2015

v1.0

1.0.0.0 http://workwithhuddle.com

Laravel wrapper for zendesk/zendesk_api_client_php package

  Sources   Download

The Requires

 

by Huddle Digital Ltd

zendesk