2017 © Pedro Peláez
 

library fogbugz-api

API interface for FogBugz

image

there4/fogbugz-api

API interface for FogBugz

  • Tuesday, December 5, 2017
  • by craig-davis
  • Repository
  • 6 Watchers
  • 18 Stars
  • 6,560 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 2 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

FogBugz PHP API Maintainability Test Coverage Build Status

PHP Wrapper for FogBugz 8 XML API, (*1)

See the api documentation at XML API Documentation, (*2)

This is a small API used to wrap up the FogBugz API into an easy to call object. It allows access to all of the API commands exposed by FogBugz, and returns a SimpleXMLElement object for any commands that return data., (*3)

FogBugz CLI

This project was written in support for a FogBugz command line client. Check out my repo at there4/fogbugz-php-cli for a working command line tool for FogBugz. You can notate cases, track time working, and review histories. Try it, you'll like it., (*4)

Sample Code

<?php
use There4\FogBugz;
$fogbugz = new FogBugz\Api(
    'username@example.com',
    'password',
    'http://example.fogbugz.com'
);
$fogbugz->logon();
$fogbugz->startWork(array(
    'ixBug' => 23442
));

Sample Code 2 (using FogBugz' API Token)

<?php
use There4\FogBugz;
$fogbugz = new FogBugz\Api(
    '',
    '',
    'http://example.fogbugz.com'
);
$fogbugz->setToken('your_token');
$fogbugz->startWork(array(
    'ixBug' => 23442
));

Magic Methods

The API uses __call() to make a method for each api endpoint in the FogBugz API. For example, to call the stopWork api endpoint, simple call a method on the fogbugz object $fogbugz->stopWork(). If you want to call the api with specific parameters, supply those to the function as an associative array, as in the sample above., (*5)

Return Format

Remember that the api methods return SimpleXMLElement objects. See the sample.php file for an example of this., (*6)

Changelog

  • 1.0.4: Add setProxy() method to the Curl class
  • 1.0.5: Add setToken() method to the Api class
  • 2.0.0: Upgrade to PHP7 only in testing and update tooling

The Versions