Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Commit

Permalink
first code push - 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgoslett committed Feb 4, 2016
1 parent fcbe3b5 commit 77462d3
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea
composer.lock
vendor
bin
coverage
coverage.xml
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# laravel-zendesk

A Laravel Zendesk library for integrating with the Zendesk API

[![Author](http://img.shields.io/badge/author-@superbalist-blue.svg?style=flat-square)](https://twitter.com/superbalist)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Packagist Version](https://img.shields.io/packagist/v/superbalist/laravel-zendesk.svg?style=flat-square)](https://packagist.org/packages/superbalist/laravel-zendesk)
[![Total Downloads](https://img.shields.io/packagist/dt/superbalist/laravel-zendesk.svg?style=flat-square)](https://packagist.org/packages/superbalist/laravel-zendesk)

This package provides a Laravel service provider and facade for the zendesk/zendesk_api_client_php package.

## Installation

```bash
composer require superbalist/laravel-zendesk
```

Register the service provider in app.php
```php
'providers' => array(
'Superbalist\Zendesk\ZendeskServiceProvider',
)
```

Register the facade in app.php
```php
'aliases' => array(
'Zendesk' => 'Superbalist\Zendesk\ZendeskFacade',
)
```

Create a services.php config file.
```php
<?php

return array(

'zendesk' => array(
'subdomain' => '[[your zendesk subdomain]]',
'username' => '[[your zendesk username]]',
'token' => '[[your zendesk api token]]',
),

);
```

## Usage

Please see https://github.com/zendesk/zendesk_api_client_php for full documentation on the core API.

All functions provided by the core API are available behind the `Zendesk` facade in Laravel.

```php
use Zendesk;

// get all tickets
$zendesk = Zendesk::tickets()->findAll();

// create a new ticket
$ticket = Zendesk::tickets()->create([
'subject' => 'The quick brown fox jumps over the lazy dog',
'comment' => [
'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
],
'priority' => 'normal'
]);
```
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0 - 2016-02-04

* Initial release
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "superbalist/laravel-zendesk",
"description": "A Laravel Zendesk library for integrating with the Zendesk API",
"license": "MIT",
"authors": [
{
"name": "Superbalist.com a division of Takealot Online (Pty) Ltd",
"email": "info@superbalist.com"
}
],
"require": {
"php": ">=5.5.0",
"illuminate/support": ">=4.0.0",
"zendesk/zendesk_api_client_php": "~2.0"

},
"autoload": {
"psr-4": {
"Superbalist\\Zendesk\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
}
}
18 changes: 18 additions & 0 deletions src/ZendeskFacade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace Superbalist\Zendesk;

use Illuminate\Support\Facades\Facade;

class ZendeskFacade extends Facade
{

/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'zendesk';
}
}
30 changes: 30 additions & 0 deletions src/ZendeskServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace Superbalist\Zendesk;

use Illuminate\Support\ServiceProvider;
use Zendesk\API\HttpClient as ZendeskAPI;

class ZendeskServiceProvider extends ServiceProvider
{

/**
* Register the service provider.
*/
public function register()
{
$this->app->bind('zendesk', function() {
$client = new ZendeskAPI(
$this->app['config']->get('services.zendesk.subdomain'),
$this->app['config']->get('services.zendesk.username')
);
$client->setAuth(
'basic',
array(
'username' => $this->app['config']->get('services.zendesk.username'),
'token' => $this->app['config']->get('services.zendesk.token'),
)
);
return $client;
});
}
}

0 comments on commit 77462d3

Please sign in to comment.