2017 © Pedro Peláez
 

library handesk-php

Handesk PHP sdk

image

badchoice/handesk-php

Handesk PHP sdk

  • Sunday, April 29, 2018
  • by BadChoice
  • Repository
  • 1 Watchers
  • 3 Stars
  • 730 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 50 % Grown

The README.md

A Handesk PHP sdk

Check the full project at https://github.com/BadChoice/handesk, (*1)

Installation

composer require badchoice/handesk-php

Usage

Initializaion

To initialize the Handesk-php sdk you simply need to call to, (*2)

Handesk::setup('your-handesk-url', 'your-handesk-api-token');

If you use laravel you can use the config/services.php file and do it like this, (*3)

// In AppServiceProvider boot method
Handesk::setup(config('services.handesk.url'), config('services.handesk.token'));
    //In config.services.php file
    'handesk' => [
        'url'   => env('HANDESK_URL', 'http://handesk.dev/api'),
        'token' => env('HANDESK_TOKEN', 'the-api-token')
    ],
Tickets

To get the open tickets for a requester (it only returns the ticket header, see find below to get the full ticket), (*4)

$tickets = (new Ticket)->get('requesterNameOrEmail');

You can ask for the closed, or solved adding a second parameter, (*5)

$solvedTickets = (new Ticket)->get('requesterNameOrEmail','solved');
$openTickets = (new Ticket)->get('requesterNameOrEmail','solved');

You can create new tickets as well, (*6)

$ticket_id = (new Ticket)->create(
    ["name" => "Requester name", "email" => "requester@email.com"], 
    "The ticket subject", 
    "The ticket initial body", 
    ["tag1","tag2"]
   );

And then fetch a ticket, (*7)

$ticket = (new Ticket)->find($id);
$comments = $ticket->comments; //Includes the initial comment
$comments->first()->requester; // ["name" => "Requester name", "email" => "Requester email"]

Adding comments to tickets, (*8)

$ticket->addComment("Adding a comment");
$ticket->addComment("Adding a comment and solving the ticket", true);
Teams
    $team = Team::create("team name", "team email";
    (new Team(2))->tickets();           //gets all open tickets for team with id 2
    (new Team(2))->tickets('solved');   //gets all solved tickets for team with id 2
    (new Team(2))->ticketsCount();      //gets the count of all open tickets for team with id 2
    (new Team(2))->ticketsCount('closed'); //gets the count of all closed tickets for team with id 2

    (new Team(2))->leads();      //gets the open leads for a team (paginated)
    (new Team(2))->leadsCount(); //gets the count of all live leads for team with id 2
Leads

To create a lead simply call:, (*9)

$id = (new Lead)->create([
            "email"       => "bruce@wayne.com",
            "body"        => "I'm interested in buying this awesome app",
            "username"    => "brucewayne",
            "name"        => "Bruce Wayne",
            "phone"       => "0044 456 567 54",
            "address"     => "Wayne manner",
            "city"        => "Gotham",
            "postal_code" => "90872",
            "company"     => "Wayne enterprises"]
            ,
            ["lightning","handesk"]
        );

Only name is a required field, (*10)

Development

PRs welcome, (*11)

The Versions

29/04 2018

dev-master

9999999-dev

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice

29/04 2018

0.1.4

0.1.4.0

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice

18/04 2018

0.1.3

0.1.3.0

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice

13/04 2018

0.1.2

0.1.2.0

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice

14/08 2017

0.1.1

0.1.1.0

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice

14/08 2017

0.1

0.1.0.0

Handesk PHP sdk

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar BadChoice