1. Go to this page and download the library: Download comoco/trac-client-php 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/ */
comoco / trac-client-php example snippets
use Comoco\TracClientPhp\Client as TracClient;
$api_url = "http://trac.local/login/jsonrpc";
$username = '<your username>';
$password = '<your password>';
$tracClient = new TracClient($api_url, $username, $password);
$ticket_id = $tracClient->createTicket('my first ticket', 'ticket content', [
'owner' => 'bob',
'cc' => 'alice, web',
'priority' => 'minor'
]);
$tracClient->uploadAttachment($ticket_id, 'example.xml', 'is a example file', "/tmp/example.xml");
$tracClient->addComment($ticket_id, 'It is great!');
$tracClient->resolveTicket($ticket_id, 'ok', 'fixed')