linkorb/ticketbox-client

TicketBox Client for TicketBox Application

v1.1 2015-11-24 06:43 UTC

README

Create tickets for TicketBox and view activities from your application

Installation

composer require linkorb/ticketbox-client

Example

Create Client

require_once __DIR__ . '/../vendor/autoload.php'; 

use Linkorb\TicketBoxClient\Client as Client;
use Linkorb\TicketBoxClient\Ticket as Ticket;

// get the client
$client = new Client(
    'http://tickets.dev/api/v1/',
    <username>,
    <password>
);

Create Ticket by logged in User

// Create Ticket with Logged in user
$ticket = new Ticket( $client ); // padidng client
$ticket->setSubject(<ticket subject>);
$ticket->setDescription(<ticket descripton>);

try {
	$ticket->create(); 
} catch( Exception $e ) {
	echo $e->getMessage();
} 

Create ticket by Anonymous user

// Create Anon Ticket
$ticket = new Ticket( $client );
$ticket->setSubject(<ticket subject>);
$ticket->setDescription(<ticket descripton>);
$ticket->setUser(<ticket user full name>);
$ticket->setEmail(<ticket email>);
$ticket->setPhone(<ticket phone>);
$ticket->setOrg(<ticket org>);

try {
	$ticket->create(); 
} catch( Exception $e ) {
	echo $e->getMessage();
} 

Get Ticket & its activities

// Create Anon Ticket
$ticket = new Ticket( $client );

$ticket->get(<ticket id>);
echo $ticket->getSubject(); // all the field null if not found. 

$activities = $ticket->getActivity(); // get activities
var_dump($activities);

Change status of ticket

// Get ticket
$ticket = new Ticket( $client );
$ticket->get(5);

try {
	$ticket->setPending(); 
	// $ticket->setClose(); 
	// $ticket->setSchedule(); 

} catch ( Exception $e ) {
	echo $e->getMessage();
}

Message ticket

// Get ticket
$ticket = new Ticket( $client );
$ticket->get(<ticket id>);

try {
	
	$ticket->message( <ticket message> ); 

} catch ( Exception $e ) {
	echo $e->getMessage();
}

Transfer Ticket

// Get ticket
$ticket = new Ticket( $client );
$ticket->get(<ticket id>);

try {
	$ticket->transfer(<queue id>); 
} catch ( Exception $e ) {
	echo $e->getMessage();
}

Brought to you by the LinkORB Engineering team

687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67
Check out our other projects at engineering.linkorb.com.

Btw, we're hiring!