PHPackages                             majidse/zendesk-laravel - 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. majidse/zendesk-laravel

ActiveLibrary[API Development](/categories/api)

majidse/zendesk-laravel
=======================

Laravel wrapper for zendesk/zendesk\_api\_client\_php package

v3.0(7y ago)09PHPPHP &gt;=5.4.0

Since Jun 2Pushed 6y agoCompare

[ Source](https://github.com/majidse/zendesk-laravel)[ Packagist](https://packagist.org/packages/majidse/zendesk-laravel)[ Docs](http://workwithhuddle.com)[ RSS](/packages/majidse-zendesk-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (12)Used By (0)

Laravel Zendesk
===============

[](#laravel-zendesk)

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

The package simply provides a `Zendesk` facade that acts as a wrapper to the [zendesk/zendesk\_api\_client\_php](https://github.com/zendesk/zendesk_api_client_php) package.

**NB:** Currently only supports token-based authentication.

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

[](#installation)

You can install this package via Composer using:

```
composer require huddledigital/zendesk-laravel
```

You must also install the service provider.

> Laravel 5.5+ users: this step may be skipped, as the package supports auto discovery.

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

If you want to make use of the facade you must install it as well.

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

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

[](#configuration)

To publish the config file to `app/config/zendesk-laravel.php` run:

```
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:

- `ZENDESK_SUBDOMAIN`

The subdomain part of your Zendesk organisation URL.

e.g.  use **huddledigital**

- `ZENDESK_USERNAME`

The username for the authenticating account.

- `ZENDESK_TOKEN`

The API access token. You can create one at: `https://SUBDOMAIN.zendesk.com/agent/admin/api/settings`

Usage
-----

[](#usage)

### Facade

[](#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](https://github.com/zendesk/zendesk_api_client_php#usage)) are available through the facade. for example:

```
// 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

[](#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.

```
