Git Product home page Git Product logo

basecamp's Introduction

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.

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()

Requirements

  • php 5.3+ (uses namespaces)

Getting Started

Please find plenty of working examples in the basecamp/example/basecamp directory. Here’s the basics:

First Steps

  1. git clone git://github.com/sirprize/basecamp.git sirprize-basecamp
  2. cd sirprize-basecamp
  3. curl -sS https://getcomposer.org/installer | php
  4. php composer.phar install
  5. create a dummy project in your basecamp account
  6. adjust sirprize-basecamp/example/basecamp/_config.php with your own settings
  7. make files executable in sirprize-basecamp/example/basecamp/(milestone|person|project|todoitem|todolist)/*
  8. make writeable sirprize-basecamp/example/_logs
  9. run examples

Setup

use Sirprize\Basecamp\Service;

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

$service = new Service($config);

Fetch all projects

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

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

Copy a project

use Sirprize\Basecamp\Id;

/*
 *
 * populate the target-project with the milestones,
 * todo-lists and todo-items from the source-project
 *
 */

$sourceProjectId = new Id('xxx');
$targetProjectId = new Id('yyy');

$projects = $service->getProjectsInstance();
$sourceProject = $projects->startById($sourceProjectId);
$sourceProject->copy($targetProjectId);

Replicate a project (push deadlines to a new date)

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
 *
 */

$sourceProjectId = new Id('xxx');
$targetProjectId = new Id('yyy');

$projects = $service->getProjectsInstance();
$sourceProject = $projects->startById($sourceProjectId);
$referenceDate = new Date('2010-12-30');
$referenceMilestone = Export::REFERENCE_EXTREMITY_LAST;
$sourceProject->replicate($targetProjectId, $referenceDate, $referenceMilestone);

Create a new milestone

use Sirprize\Basecamp\Id;
use Sirprize\Basecamp\Date;

$milestones = $service->getMilestonesInstance();
$milestone = $milestones->getMilestoneInstance();
$deadline = new Date('2010-03-01');
$projectId = new Id('xxx');
$userId = new Id('xxx');

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

Todo

  • Account
  • Companies
  • Categories
  • Messages
  • Comments: create(), update(), delete()
  • Time tracking: startAllByTodoItemId(), create(), update(), delete()

Contributors

basecamp's People

Contributors

itsazzad avatar lacyrhoades avatar sirprize avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.