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

Commit 77462d3

Browse files
first code push - 1.0.0
1 parent fcbe3b5 commit 77462d3

File tree

6 files changed

+154
-0
lines changed

6 files changed

+154
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
composer.lock
3+
vendor
4+
bin
5+
coverage
6+
coverage.xml

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# laravel-zendesk
2+
3+
A Laravel Zendesk library for integrating with the Zendesk API
4+
5+
[![Author](http://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/superbalist)
6+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
7+
[![Packagist Version](https://img.shields.io/packagist/v/superbalist/laravel-zendesk.svg?style=flat-square)](https://packagist.org/packages/superbalist/laravel-zendesk)
8+
[![Total Downloads](https://img.shields.io/packagist/dt/superbalist/laravel-zendesk.svg?style=flat-square)](https://packagist.org/packages/superbalist/laravel-zendesk)
9+
10+
This package provides a Laravel service provider and facade for the zendesk/zendesk_api_client_php package.
11+
12+
## Installation
13+
14+
```bash
15+
composer require superbalist/laravel-zendesk
16+
```
17+
18+
Register the service provider in app.php
19+
```php
20+
'providers' => array(
21+
'Superbalist\Zendesk\ZendeskServiceProvider',
22+
)
23+
```
24+
25+
Register the facade in app.php
26+
```php
27+
'aliases' => array(
28+
'Zendesk' => 'Superbalist\Zendesk\ZendeskFacade',
29+
)
30+
```
31+
32+
Create a services.php config file.
33+
```php
34+
<?php
35+
36+
return array(
37+
38+
'zendesk' => array(
39+
'subdomain' => '[[your zendesk subdomain]]',
40+
'username' => '[[your zendesk username]]',
41+
'token' => '[[your zendesk api token]]',
42+
),
43+
44+
);
45+
```
46+
47+
## Usage
48+
49+
Please see https://github.com/zendesk/zendesk_api_client_php for full documentation on the core API.
50+
51+
All functions provided by the core API are available behind the `Zendesk` facade in Laravel.
52+
53+
```php
54+
use Zendesk;
55+
56+
// get all tickets
57+
$zendesk = Zendesk::tickets()->findAll();
58+
59+
// create a new ticket
60+
$ticket = Zendesk::tickets()->create([
61+
'subject' => 'The quick brown fox jumps over the lazy dog',
62+
'comment' => [
63+
'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
64+
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
65+
],
66+
'priority' => 'normal'
67+
]);
68+
```

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0 - 2016-02-04
4+
5+
* Initial release

composer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "superbalist/laravel-zendesk",
3+
"description": "A Laravel Zendesk library for integrating with the Zendesk API",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Superbalist.com a division of Takealot Online (Pty) Ltd",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"require": {
12+
"php": ">=5.5.0",
13+
"illuminate/support": ">=4.0.0",
14+
"zendesk/zendesk_api_client_php": "~2.0"
15+
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"Superbalist\\Zendesk\\": "src/"
20+
}
21+
},
22+
"extra": {
23+
"branch-alias": {
24+
"dev-master": "1.0-dev"
25+
}
26+
}
27+
}

src/ZendeskFacade.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace Superbalist\Zendesk;
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class ZendeskFacade extends Facade
7+
{
8+
9+
/**
10+
* Get the registered name of the component.
11+
*
12+
* @return string
13+
*/
14+
protected static function getFacadeAccessor()
15+
{
16+
return 'zendesk';
17+
}
18+
}

src/ZendeskServiceProvider.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
namespace Superbalist\Zendesk;
3+
4+
use Illuminate\Support\ServiceProvider;
5+
use Zendesk\API\HttpClient as ZendeskAPI;
6+
7+
class ZendeskServiceProvider extends ServiceProvider
8+
{
9+
10+
/**
11+
* Register the service provider.
12+
*/
13+
public function register()
14+
{
15+
$this->app->bind('zendesk', function() {
16+
$client = new ZendeskAPI(
17+
$this->app['config']->get('services.zendesk.subdomain'),
18+
$this->app['config']->get('services.zendesk.username')
19+
);
20+
$client->setAuth(
21+
'basic',
22+
array(
23+
'username' => $this->app['config']->get('services.zendesk.username'),
24+
'token' => $this->app['config']->get('services.zendesk.token'),
25+
)
26+
);
27+
return $client;
28+
});
29+
}
30+
}

0 commit comments

Comments
 (0)