PHP SDK for CodebaseHQ ( API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PHP SDK for CodebaseHQ API

CodebaseHQ is software project management tool with Git, Mercurial and Subversion hosting, bug and time tracking, and more.


This package can be installed using Composer:

    "minimum-stability": "dev",
    "require": {
        "mtymek/codebasehq-sdk": "dev-master"


Please refer to this document for general information about CodebaseHQ API.

First, you need to create API client, and pass your account, username and API key:

$client = new CodebaseHq\Api('someaccount', 'mtymek', '85j9axug8r2mb42ao5rf59nrpstesdujbj05x2ih');

Example: listing tickets

Tickets are related organized in projects, so you need to begin with setting project name:


Now you're allowed to find tickets matching given query:

// list all closed tickets for current user
$tickets = $client->tickets()->find('assignee:me status:closed');

Above code will return array of CodebaseHq\Entity\Ticket objects.

You can also fetch single ticket:

$ticket = $client->tickets()->findOneById(124);


At this moment object interface supports only subset of Codebase HQ API. You can also access it directly, using low-level calls that work on XML data:

// Example: listing all assigned tickets
$result = $api->api('/mats-playground/tickets?query=' . urlencode('assignee:me'));
$xml = new SimpleXMLElement($result);
foreach ($xml->ticket as $ticket) {
    echo $ticket->{'ticket-id'} . ': ' . $ticket->summary, "\n";

// Example: tracking time session
$xml =
    <summary>Worked on the awesome feature</summary>
$api->api('/mats-playground/time_sessions', 'POST', $xml);

You can avoid passing XML directly by using buildXml() helper method:

// Example: ticket update
$ticketNote = array(
    'content' => 'Lorem Ipsum dolor sit amet.',
    'time-added' => '1:00'
$result = $api->api(
                $api->buildXml('ticket-note', $ticketNote)


  • basic, low-level API access [IMPLEMENTED]
  • nice, object-oriented interface for accessing all types of records defined by CodebaseHQ API [IN PROGRESS]