This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcbe3b5
commit 77462d3
Showing
6 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea | ||
composer.lock | ||
vendor | ||
bin | ||
coverage | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 1.0.0 - 2016-02-04 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); | ||
} | ||
} |