Laravel wrapper for zendesk/zendesk_api_client_php package.

Overview

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 package.

NB: Currently only supports token-based authentication.

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

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. http://huddledigital.zendesk.com 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

  • ZENDESK_DRIVER (Optional)

Set this to null or log to prevent calling the Zendesk API directly from your environment.

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:

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

<?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.

Comments
  • Laravel 9.x Compatibility

    Laravel 9.x Compatibility

    This is an automated pull request from Shift to update your package code and dependencies to be compatible with Laravel 9.x.

    Before merging, you need to:

    • Checkout the l9-compatibility branch
    • Review all comments for additional changes
    • Thoroughly test your package

    If you do find an issue, please report it by commenting on this PR to help improve future automation.

    opened by laravel-shift 1
  • Add Laravel 8 Support

    Add Laravel 8 Support

    Hey,

    Laravel 8 is out and this package does not function with it yet :) I've made a PR #18 to ease things up.

    Let me know if there's anything else you think should be done.

    🙏

    opened by beNjiox 1
  • Add null & log drivers

    Add null & log drivers

    Setting ZENDESK_DRIVER=null will disable this service. Setting ZENDESK_DRIVER=log will disable this service while logging any calls made to it.

    This is helpful in testing where I might not want to make real API calls to Zendesk.

    ZENDESK_DRIVER defaults to api and will just use the normal ZendeskService so there isn't any breaking changes.

    opened by imacrayon 1
  • Laravel 5.2+ Support

    Laravel 5.2+ Support

    Hi huddle team,

    Made a few changes to make the package able to be used (and installed in composer) in Laravel 5.2+ (we are using 5.4), also modified the readme to make it more laravel 5 friendly and added php artisan vendor:publish... as well so the package settings can be extracted to the users config_path

    Thanks for the package 👍

    opened by eblin 1
  • Changed laravel/framework for illuminate/support

    Changed laravel/framework for illuminate/support

    :bulb: Changed laravel/framework for illuminate/support for better dependency management.

    This way the wrapper could be used in laravel/lumen without importing the whole laravel/framework.

    opened by jvalecillos 1
  • Annotate method hints for Laravel IDE helper

    Annotate method hints for Laravel IDE helper

    By annotating method hints PHPStorm (and other IDEs) will be available to autocomplete the methods provided by the facade. The change should just be:

    <?php namespace Huddle\Zendesk\Facades;
    
    use Illuminate\Support\Facades\Facade;
    
    /**
     * @mixin \Zendesk\API\HttpClient
     */
    class Zendesk extends Facade {
        …
    }
    

    Laravel IDE helper will be able to extract this annotation and provide IDE autocompletion.

    opened by georgms 0
  • "message": "Class 'Huddle\\Zendesk\\Providers\\ZendeskServiceProvider' not found"

    Afte install library and use my app for each request I have this message "message": "Class 'Huddle\Zendesk\Providers\ZendeskServiceProvider' not found",

    I try use composer dump-autoload but it did not help

    PHP 7.4 laravel 8

    opened by vetaloffline 0
  • Add tags

    Add tags

    Hello! How i can add tags to ticket?

    Zendesk::tickets()->update($id,[
                'priority' => $priority,
                'comment'  => [
                    'body' => $text,
                    'public' => false,
                ],
                'tags' => ['support_bot_update_priority']
            ]);
    

    This delete all tags, and set one tag "support_bot_update_priority" I try use

    Zendesk::tickets()->update($id,[
                'priority' => $priority,
                'comment'  => [
                    'body' => $text,
                    'public' => false,
                ],
                '**additional_tags**' => ['support_bot_update_priority']
            ]);
    

    it's not work((

    opened by polarikus 0
  • How can I call the Help Center in the API

    How can I call the Help Center in the API

    Hi all,

    I call: Zendesk::helpCenter->articles()->findAll(); or $zd = new \Zendesk(); $zd->helpCenter->articles()->findAll();

    Error: ErrorException Undefined property: Huddle\Zendesk\Facades\Zendesk::$helpCenter

    How can i call help center? Thanks for watching

    opened by nguyendachuy 1
  • Create/Update doesn`t work on PHP7

    Create/Update doesn`t work on PHP7

    Due to official PHP Toolkit doesnt support PHP7 on create/update operations Ive discover issue fix https://github.com/developerforce/Force.com-Toolkit-for-PHP/pull/48/files and apply it to your code So you can look at it and apply this update for fixing this issue

    SforceEnterpriseClient.zip

    opened by ghost 0
Releases(v3.7)
Owner
Huddle Digital
Huddle are a young startup offering completely bespoke website design and development, hosting, user testing and UX consultancy.
Huddle Digital
27Laracurl Laravel wrapper package for PHP cURL class that provides OOP interface to cURL. [10/27/2015] View Details

Laracurl Laravel cURL Wrapper for Andreas Lutro's OOP cURL Class Installation To install the package, simply add the following to your Laravel install

zjango 8 Sep 9, 2018
A wrapper package to run mysqldump from laravel console commands.

A wrapper package to run mysqldump from laravel console commands.

Yada Khov 24 Jun 24, 2022
Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite

Mollie for Laravel Laravel-Mollie incorporates the Mollie API and Mollie Connect into your Laravel or Lumen project. Accepting iDEAL, Apple Pay, Banco

Mollie 289 Nov 24, 2022
A Laravel Wrapper for the CoinDCX API. Now easily connect and consume the CoinDCX Public API in your Laravel apps without any hassle.

This package provides a Laravel Wrapper for the CoinDCX API and allows you to easily communicate with it. Important Note This package is in early deve

Moinuddin S. Khaja 2 Feb 16, 2022
A CommonMark wrapper for Laravel

Laravel Markdown Laravel Markdown was created by, and is maintained by Graham Campbell, and is a CommonMark wrapper for Laravel. It ships with integra

Graham Campbell 1.2k Jan 2, 2023
PayuMoney Gateway wrapper for Laravel.

PayuMoney Integration with Laravel Easy to use integration for PayUMoney into Laravel apps. Video Tutorial Usage composer require infyomlabs/laravel-p

InfyOmLabs (InfyOm Technologies) 10 Nov 29, 2022
A Laravel wrapper for spatie/dns. Allows to query and validate DNS records.

A Laravel wrapper for spatie/dns. Allows to query and validate DNS records.

Astrotomic 22 Nov 17, 2022
Laravel API wrapper to interact fluently with your Janus Media Server

Laravel API wrapper to interact fluently with your Janus Media Server. Core server interactions, as well as the video room plugin included.

Richard  Tippin 11 Aug 21, 2022
A laravel wrapper for BnpParibas Mercanet payment gateway

Laravel Mercanet A laravel wrapper for BnpParibas Mercanet which provide a lightweight public api to process your online payments from your laravel ap

Mouad ZIANI 29 Nov 27, 2022
Open Food Facts API wrapper for Laravel

Laravel Open Food Facts API This package provides a convenient wrapper to the Open Food Facts API for Laravel applications (5.7+). Installation You ca

Open Food Facts 112 Jan 4, 2023
a Google API v3 wrapper for Laravel 4.x

A Google API v3 wrapper for Laravel 4 This package enables a Laravel flavoured way to manage Google services through its API interface (v3) Installati

null 4 Nov 29, 2022
Laravel wrapper for Sentry Official API

Laravel Sentry API Provides a simple laravel wrapper to some of the endpoints listed on (Official Sentry API)[https://docs.sentry.io/api/]. **Note: Th

Pedro Santiago 1 Nov 1, 2021
Laravel wrapper for the Gmail API

Laravel Gmail Gmail Gmail API for Laravel 8 You need to create an application in the Google Console. Guidance here. if you need Laravel 5 compatibilit

Daniel Castro 244 Jan 3, 2023
Simple and ready to use API response wrapper for Laravel.

Laravel API Response Simple Laravel API response wrapper. Installation Install the package through composer: $ composer require obiefy/api-response Re

Obay Hamed 155 Dec 14, 2022
A DOMPDF Wrapper for Laravel

DOMPDF Wrapper for Laravel Laravel wrapper for Dompdf HTML to PDF Converter Require this package in your composer.json and update composer. This will

Barry vd. Heuvel 5.6k Dec 25, 2022
A Laravel wrapper for apex charts

Larapex Charts A Laravel wrapper for apex charts library Check the documentation on: Larapex Chart Docs. Installation Use composer. composer require a

ArielMejiaDev 189 Dec 26, 2022
Laravel SoapClient Wrapper

Laravel SoapClient Wrapper A SoapClient wrapper integration for Laravel. Makes it easy to use Soap in a Laravel application. Please report any bugs or

Michael v/d Rijt 618 Dec 12, 2022
A Laravel wrapper for healthchecks.io

Healthchecks.io is a service that monitors your cron jobs and alerts you when they are down. This package is a wrapper for the Healthchecks.io API.

Robin Martijn 4 Nov 7, 2022
A wrapper of voku/anti-xss for Laravel

Laravel Security Laravel Security was created by, and is maintained by Graham Campbell, and is a voku/anti-xss wrapper for Laravel, using graham-campb

Graham Campbell 170 Nov 20, 2022