jakoch / php-trac-rpc
A library to interact with a Trac Bugtracker API via remote procedure calls.
This package is auto-updated.
Last update: 2024-12-05 18:27:47 UTC
README
TracRPC
The purpose of this class is to interact with the Trac API from a remote location by remote procedure calls.
Trac is a project management and bug/issue tracking system. http://trac.edgewall.org/
Trac by itself does not provide an API. You must install the XmlRpcPlugin. Trac then provides anonymous and authenticated access to the API via two protocols XML-RPC and JSON-RPC. http://trac-hacks.org/wiki/XmlRpcPlugin/
Requirements
- PHP 5.3.0 or higher
- The PHP Extensions "JSON" and "cURL" are required.
- Trac with XmlRpcPlugin
Features
- Make Requests to the TRAC API using the following request methods.
Installation
a) Download the ZIP from Github, then extract the library file and include it.
b) Installation via Composer
To add PHPTracRPC as a local, per-project dependency to your project, simply add jakoch/php-trac-rpc
to your project's composer.json
file.
{
"require": {
"jakoch/php-trac-rpc": "dev-master"
}
}
Usage
Step 1: include library
When you installed via Composer, please include the Composer Autoloader first and then instantiate the TracRPC class.
include __DIR__.'/vendor/autoload.php';
When you fetched the zip file, please include the lib directly.
include __DIR__.'/lib/TracRPC.php';
Step 2: setup credentials and instantiate TracRPC
$credentials = array('username' => 'username', 'password' => 'password');
$trac = new \TracRPC\TracRPC('http://trac.example.com/login/jsonrpc', $credentials);
Step 3: do some requests
Single Call Example
$result = $trac->getTicket('32');
if ($result === false) {
die('ERROR: '.$trac->getErrorMessage());
} else {
var_dump($result);
}
Multi Call Example
$trac->setMultiCall(true);
$ticket = $trac->getTicket('32');
$attachments = $trac->getTicketAttachments('list', '32');
$trac->doRequest();
$ticket = $trac->getResponse($ticket);
$attachments = $trac->getResonse($attachments);
var_dump($ticket, $attachments);
Request Methods
- getRecentChangedWikiPages($date = 0)
- getWikiPage($name = '', $version = 0, $raw = true)
- getWikiPageInfo($name = '', $version = 0)
- getWikiPages()
- getRecentChangedTickets($date = 0)
- getTicket($id = '')
- getTicketFields()
- getTicketChangelog($id = '', $when = 0)
- getTicketActions($id = '')
- getWikiAttachments($action = 'list', $name = '', $file = '')
- getTicketAttachments($action = 'list', $id = '', $file = '', $desc = '', $replace = true)
- getWikiUpdate($action = 'create', $name = '', $page = '', $data = array())
- getTicketUpdate($action = 'create', $id = '', $data = array())
- getTicketSearch($query = '')
- getTicketComponent($action = 'get_all', $name = '', $attr = array())
- getTicketMilestone($action = 'get_all', $name = '', $attr = array())
- getTicketPriority($action = 'get_all', $name = '', $attr = '')
- getTicketResolution($action = 'get_all', $name = '', $attr = '')
- getTicketSeverity($action = 'get_all', $name = '', $attr = '')
- getTicketType($action = 'get_all', $name = '', $attr = '')
- getTicketVersion($action = 'get_all', $name = '', $attr = array())
- getTicketStatus()
- getSearch($query = '', $filter = array())
- getWikiTextToHTML($text = '')
- getSearchFilters()
- getApiVersion()