Skip to content
sirprize edited this page Sep 14, 2010 · 17 revisions

Basecamp API Wrapper for php 5.3+

This is a php library to access the Basecamp api. Collection classes provide methods to query the api and wrap each result item in an entity object. Entity objects come with methods such as update() and delete() to persist themselfes via the api. Functionality is provided to attach and detach observers to collections and entities.

Supported Features

  • Person: fully implemented
  • Project: fully implemented
  • Milestone: fully implemented
  • Todolist: fully implemented
  • Todoitems: fully implemented

Requirements

  • php 5.3+ (uses namespaces)
  • Recent version of zend framework (tested with 1.10) > uses Zend_Http_Client & Zend_Log (optional)

Getting Started

Please find plenty of working examples in the basecamp/example/basecamp directory and adjust basecamp/example/basecamp/_config.php with your own settings. Here’s the basics:

Setup

$config = array(
	'baseUri' => 'https://xxx.basecamphq.com',
	'username' => 'xxx',
	'password' => 'xxx'
);

require_once 'Sirprize/Basecamp.php';
$basecamp = new \Sirprize\Basecamp($config);

Fetch all projects

$projects = $basecamp->getProjectsInstance()->startAll();

foreach($projects as $project)
{
	print $project->getName()."\n";
}

Create a new milestone

$milestones = $basecamp->getMilestoneCollectionInstance();
$milestone = $milestones->getMilestoneInstance();

require_once 'Sirprize/Basecamp/Date.php';
$deadline = new \Sirprize\Basecamp\Date('2010-03-01');

require_once 'Sirprize/Basecamp/Id.php';
$projectId = new \Sirprize\Basecamp\Id('xxx');
$userId = new \Sirprize\Basecamp\Id('xxx');

$milestone
	->setProjectId($projectId)
	->setResponsiblePartyId($userId)
	->setDeadline($deadline)
	->setTitle('Milestoners Everywhere')
	->setWantsNotification(true)
	->create()
;

Todo

  • Account
  • Companies
  • Categories
  • Messages
  • Comments
  • Time tracking
Clone this wiki locally