PHP code example of linkorb / ticketbox-client

1. Go to this page and download the library: Download linkorb/ticketbox-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

linkorb / ticketbox-client example snippets




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 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 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();
} 

// 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);

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

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

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

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

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

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

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

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