git clone git://github.com/sirprize/basecamp.git sirprize-basecamp
May 30, 2013 · View on GitHub
h1. Basecamp Classic API Wrapper for php 5.3+
This is a php library to access the classic 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 - this is useful for logging or to print current activity to the terminal.
h2. Supported Features
- Person: startMe(), startById(), startAllByProjectId(), startAll() etc
- Project: startById(), startAll(), copy(), replicate() etc
- Milestone: startAllByProjectId(), create(), update(), delete(), complete(), uncomplete() etc
- Todolist: startById(), startAllByProjectId(), startAllByResponsibiltyParty(), create(), update(), delete() etc
- Todoitems: startAllByTodoListId(), startById(), create(), update(), delete(), complete(), uncomplete() etc
- Comments: startAllByResourceId(), startById()
- Timetracking: startAllByProjectId(), startById()
h2. Requirements
- php 5.3+ (uses namespaces)
h2. Getting Started
Please find plenty of working examples in the basecamp/example/basecamp directory. Here's the basics:
h3. First Steps
git clone git://github.com/sirprize/basecamp.git sirprize-basecamp
cd sirprize-basecamp
curl -sS https://getcomposer.org/installer | php
php composer.phar install
create a dummy project in your basecamp account
adjust _sirprize-basecamp/example/basecamp/config.php with your own settings
make files executable in sirprize-basecamp/example/basecamp/(milestone|person|project|todoitem|todolist)/*
make writeable _sirprize-basecamp/example/logs
run examples
h3. Setup
bc.. use Sirprize\Basecamp\Service;
$config = array( 'baseUri' => 'https://xxx.basecamphq.com', 'username' => 'xxx', 'password' => 'xxx' );
config);
h3. Fetch all projects
bc.. service->getProjectsInstance()->startAll();
foreach(project) { print $project->getName()."\n"; }
h3. Copy a project
bc.. use Sirprize\Basecamp\Id;
/* *
- populate the target-project with the milestones,
- todo-lists and todo-items from the source-project
*/
targetProjectId = new Id('yyy');
service->getProjectsInstance(); projects->startById(sourceProject->copy($targetProjectId);
h3. Replicate a project (push deadlines to a new date)
bc.. use Sirprize\Basecamp\Id; use Sirprize\Basecamp\Date; use Sirprize\Basecamp\Schema\Export;
/* *
- populate the target-project with the milestones,
- todo-lists and todo-items from the source-project.
- the last milestone deadline is pushed to 2010-12-30 and
- all other deadlines will be calculated relative to it
*/
targetProjectId = new Id('yyy');
service->getProjectsInstance(); projects->startById(referenceDate = new Date('2010-12-30'); sourceProject->replicate(referenceDate, $referenceMilestone);
h3. Create a new milestone
bc.. use Sirprize\Basecamp\Id; use Sirprize\Basecamp\Date;
service->getMilestonesInstance(); milestones->getMilestoneInstance(); projectId = new Id('xxx'); $userId = new Id('xxx');
projectId) ->setResponsiblePartyId(deadline) ->setTitle('Milestoners Everywhere') ->setWantsNotification(true) ->create() ;
h2. Todo
- Account
- Companies
- Categories
- Messages
- Comments: create(), update(), delete()
- Time tracking: startAllByTodoItemId(), create(), update(), delete()
h2. Contributors
- "lacyrhoades":https://github.com/lacyrhoades
- "morrislaptop":https://github.com/morrislaptop