nigelheap/teamwork-desk

PHP wrapper for the Teamwork desk API

1.0.3 2018-03-10 02:46 UTC

This package is auto-updated.

Last update: 2022-02-15 20:18:06 UTC


README

Build Status Release License

This is a simple PHP Client that can connect to the TeamworkDesk API. This package was developed to be used with Laravel 5 but can also be used stand alone as well. I hope this helps you automate and extend TeamworkDesk to integrate even more into your business! Have fun and good luck. 🤘

This fork also includes updates for laravel 5.5 and 5.6

Installation

Just add this to your composer.json and then run composer update.

"nigelheap/teamwork-desk": "1.0.*"

You can also simply add it like this

composer require "nigelheap/teamwork-desk:1.0.*"

Laravel Setup

This wrapper comes with support for Laravel 5. This includes a service provider as well as a facade for easy access. Once this package is pulled into your project just add this to your config/app.php file.

'providers' => [
    ...
    'NigelHeap\TeamworkDesk\TeamworkDeskServiceProvider',
],

and then add the facade to your aliases array

'aliases' => [
    ...
    'TeamworkDesk' => 'NigelHeap\TeamworkDesk\Facades\TeamworkDesk',
],

Configuration

If you are using Laravel then add a teamwork array to your config/services.php file

...
'teamwork-desk' => [
    'key'  => 'YourSecretKey',
    'url'  => 'YourTeamworkDeskUrl'
],

Use

If you are using the Facade with Laravel youc an easily access TeamworkDesk like this

TeamworkDesk::customers()->all();

If you want to use dependency injection to make your application easy to test the Service Provider binds NigelHeap\TeamworkDesk\Factory. Here is an example of how to use it with dependency injection

Route::get('/test', function(NigelHeap\TeamworkDesk\Factory $teamwork) {
   $customers = $teamwork->customers()->all();
});

Configuration Without Laravel

If you are not using Laravel you can instantiate the class like this

require "vendor/autoload.php";

use GuzzleHttp\Client as Guzzle;
use NigelHeap\TeamworkDesk\Client;
use NigelHeap\TeamworkDesk\Factory as TeamworkDesk;

$client     = new Client(new Guzzle, 'YourSecretKey', 'YourTeamworkDeskUrl');
$teamwork   = new TeamworkDesk($client);

You are ready to go now!

Examples

// get a customer
$teamwork->customers($customerId)->find();
// get a customers
$teamwork->customers()->all();
// get a tickets
$teamwork->tickets()->all();
// get a ticket
$teamwork->tickets($ticketId)->find();
// get a users
$teamwork->users()->all();

Roadmap

1.0 Release

  • Add Support For Tickets
  • Add Support For Inboxes
  • Add Support For Customers
  • Add Support For Users

1.1 Release

  • Add Support For Threads
  • Add Support For Happiness
  • Add Support For Users

1.2 Release

  • Add Support For Categories
  • Add Support For People Status
  • Add Support For Files
  • Add Support For Features

1.3 Release

  • Add Support For HelpDocs