Skip to content

Lightweight multi-paradigm PHP (JSON) client for the new Basecamp API. Inspired by, and largely cribbed from, shopify.php by @sandeepshetty

License

Notifications You must be signed in to change notification settings

bdunlap/basecamp.php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

basecamp.php

Lightweight multi-paradigm PHP (JSON) client for the new Basecamp API.

Many thanks to Sandeep Shetty, whose Shopify client provided the inspiration and much of the code for this project.

Requirements

Getting Started

Download

Download the latest version of basecamp.php:

$ curl -L http://github.com/bdunlap/basecamp.php/tarball/master | tar xvz
$ mv bdunlap-basecamp.php-* basecamp.php

Require

<?php
require 'path/to/basecamp.php/basecamp.php';
?>

Limitations

  • Currently supports private apps only.
  • This is quick and dirty and will get you started. It does not do client-side caching, which you must implement per 37signals. Pull requests welcome.

Usage

Making API calls:

<?php
$appName = 'MyApp';
$appContact = '[email protected]';

$basecampAccountId = '999999999';
$basecampUsername = 'yourusername';
$basecampPassword = 'yourpassword';

$basecamp = basecamp_api_client($appName, $appContact,
    $basecampAccountId, $basecampUsername, $basecampPassword);

try {
    /**
     * Get a list of all projects:
     */
    $projects = $basecamp('GET', '/projects.json');
    echo "Current list of projects:\n";
    foreach ($projects as $project) {
        echo "\t".$project->name."\n";
    }

    /**
     * Create a new project:
     */
    $project = array(
        'name' => 'My new project!',
    );

    $newProject = $basecamp('POST', '/projects.json', $project);
    echo "New project ID is {$newProject->id}\n";
} catch (Exception $e) {
    die($e->getMessage());
}
?>

See the Basecamp API docs for more interactions.

About

Lightweight multi-paradigm PHP (JSON) client for the new Basecamp API. Inspired by, and largely cribbed from, shopify.php by @sandeepshetty

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%