dev-master
9999999-devThe Basecamp API makes it easy for developers to communicate with the 37signals Basecamp platform
MIT
The Requires
The Development Requires
by Richard van den Brand
api basecamp 37signals
The Basecamp API makes it easy for developers to communicate with the 37signals Basecamp platform
The Basecamp SDK for PHP enables PHP developers to easily integrate 37signals Basecamp all new API into their applications., (*2)
NOTE: This library is under heavy development and a lot of calls haven't been implemented yet. We're looking forward to any of your PR's., (*3)
We recommend Composer for managing dependencies. Installing is as easy as:, (*4)
$ php composer.phar require netvlies/basecamp-php
To use the library the only requirement is you have a account. Upon creating the client you have to pass your credentials or an OAuth token. Furthermore you need your userId to construct the URI's., (*5)
<?php $client = \Basecamp\BasecampClient::factory(array( 'auth' => 'http', 'username' => 'you@email.com', 'password' => 'secret', 'user_id' => 99999999, 'app_name' => 'My Wicked Application', 'app_contact' => 'http://mywickedapplication.com' ));
This library doesn't handle the OAuth authorization process for you. There are already a lot of libraries out there which handle this process perfectly for you. When you recieved your token you'll have to pass it on to the client:, (*6)
<?php $client = \Basecamp\BasecampClient::factory(array( 'auth' => 'oauth', 'token' => 'Wtj4htewhtuewhuoitewh', 'user_id' => 99999999, 'app_name' => 'My Wicked Application', 'app_contact' => 'http://mywickedapplication.com' ));
It is required to identify you application. This can be accomplished by using app_name
and app_contact
., (*7)
This client is build upon the shoulders of the impressive Guzzle library. If you're willing to contribute to this client, make sure to check out the docs., (*8)
It is required to implement caching in your application. Lucky for you, using Guzzle this is peanuts! Please refer to the official docs for more information., (*9)
Here's a quick example using the Doctrine cache:, (*10)
<?php use Basecamp\BasecampClient; use Doctrine\Common\Cache\FilesystemCache; use Guzzle\Cache\DoctrineCacheAdapter; use Guzzle\Plugin\Cache\CachePlugin; $cachePlugin = new CachePlugin(array( 'adapter' => new DoctrineCacheAdapter(new FilesystemCache(__DIR__.'/../../../../app/cache/basecamp')) )); $this->client = BasecampClient::factory(array( // config options )); $this->client->addSubscriber($cachePlugin);
All services are documented below. View full service description in src/Basecamp/Resources/service.php, (*11)
Basecamp API: Projects, (*12)
$response = $client->getArchivedProjects();
Basecamp API: Projects, (*13)
$response = $client->getProjects();
Basecamp API: Projects, (*14)
$response = $client->getProject( array( 'id' => 1234567, // Required. Project ID ) );
Basecamp API: Documents, (*15)
$response = $client->getDocumentsByProject( array( 'projectId' => 1234567, // Required. Project ID ) );
Basecamp API: Documents, (*16)
$response = $client->getDocument( array( 'projectId' => 1234567, // Required. Project ID 'documentId' => 1234567, // Required. Document ID ) );
Basecamp API: Topics, (*17)
$response = $client->getTopicsByProject( array( 'projectId' => 1234567, // Required. Project ID ) );
Basecamp API: Todo lists, (*18)
$response = $client->getTodolistsByProject( array( 'projectId' => 1234567, // Required. Project ID ) );
Basecamp API: Todo lists, (*19)
$response = $client->getAssignedTodolistsByPerson( array( 'personId' => 1234567, // Required. Person id 'page' => 1234567, // Optional. The page to retrieve. API returns 50 todos per page. 'due_since' => 'example', // Optional. Will return all the to-do lists with to-dos assigned to the specified person due after the date specified. (format: 2012-03-24T11:00:00-06:00) ) );
Basecamp API: Todo lists, (*20)
$response = $client->getCompletedTodolistsByProject( array( 'projectId' => 1234567, // Required. Project id ) );
Basecamp API: Todos, (*21)
$response = $client->getCompletedTodosByProject( array( 'projectId' => 1234567, // Required. Project id ) );
Basecamp API: Projects, (*22)
$response = $client->createProject( array( 'name' => 'Example name', // Required. 'description' => 'Example description', // Required. ) );
Basecamp API: Documents, (*23)
$response = $client->createDocument( array( 'projectId' => 1234567, // Required. Project ID 'title' => 'example', // Required. 'content' => 'Example content', // Required. ) );
Basecamp API: Todo lists, (*24)
$response = $client->createTodolistByProject( array( 'projectId' => 1234567, // Required. Project id 'name' => 'Example name', // Required. 'description' => 'Example description', // Required. ) );
Basecamp API: Todos, (*25)
$response = $client->createTodoByTodolist( array( 'projectId' => 1234567, // Required. Project id 'todolistId' => 1234567, // Required. Todo list id 'content' => 'Example content', // Required. 'assignee' => array( 'id' => 1234567, 'type' => 'Person' ), // Optional. ) );
Basecamp API: Comments, (*26)
$response = $client->createCommentByTodo( array( 'projectId' => 1234567, // Required. Project id 'todoId' => 1234567, // Required. Todo id 'content' => 'Example content', // Required. 'attachments' => array( array( 'token' => $upload_token, 'name' => 'file.jpg' ) ), // Optional. ) );
Basecamp API: Attachments, (*27)
$response = $client->getAttachmentsByProject( array( 'projectId' => 1234567, // Required. Project id ) );
Basecamp API: Attachments, (*28)
$response = $client->createAttachment( array( 'mimeType' => 'image/jpeg', // Required. The content type of the data 'data' => file_get_contents( 'image.jpg' ), // Required. The attachment's binary data ) );
Basecamp API: Todo lists, (*29)
$response = $client->getTodolist( array( 'projectId' => 1234567, // Required. Project id 'todolistId' => 1234567, // Required. Todolist id ) );
Basecamp API: Todos, (*30)
$response = $client->getTodo( array( 'projectId' => 1234567, // Required. Project id 'todoId' => 1234567, // Required. Todo id ) );
Basecamp API: Todos, (*31)
$response = $client->updateTodo( array( 'projectId' => 1234567, // Required. Project id 'todoId' => 1234567, // Required. Todo id 'content' => 'Example content', // Optional. 'due_at' => 'example', // Optional. 'assignee' => array( 'id' => 1234567, 'type' => 'Person' ), // Optional. 'completed' => 'example', // Optional. ) );
Basecamp API: People, (*32)
$response = $client->getCurrentUser();
Basecamp API: People, (*33)
$response = $client->getSpecificUser( array( 'personId' => 1234567, // Required. Person id ) );
Basecamp API: Events, (*34)
$response = $client->getGlobalEvents( array( 'since' => '2012-03-24T11:00:00-06:00', // Optional. All events since given datetime (format: 2012-03-24T11:00:00-06:00) 'page' => 1234567, // Optional. The page to retrieve. API returns 50 events per page. ) );
Basecamp API: Events, (*35)
$response = $client->getProjectEvents( array( 'projectId' => 1234567, // Required. Project id 'since' => '2012-03-24T11:00:00-06:00', // Optional. All events since given datetime (format: 2012-03-24T11:00:00-06:00) ) );
Basecamp API: Accesses, (*36)
$response = $client->getAccessesByProject( array( 'projectId' => 1234567, // Required. Project id ) );
Basecamp API: Accesses, (*37)
$response = $client->getAccessesByCalendar( array( 'calendarId' => 1234567, // Required. Calendar id ) );
Basecamp API: People, (*38)
$response = $client->getPeople();
Basecamp API: People, (*39)
$response = $client->getGroups();
Basecamp API: Access, (*40)
$response = $client->grantAccess( array( 'projectId' => 1234567, // Required. Project id 'ids' => '', // Required. Existing user ids 'email_addresses' => 'example', // Optional. Grant access to new users ) );
Basecamp API: Calendars, (*41)
$response = $client->getCalendars();
Basecamp API: Calendars, (*42)
$response = $client->getCalendar( array( 'calendarId' => 1234567, // Required. Calendar id ) );
Basecamp API: Calendars, (*43)
$response = $client->createCalendar( array( 'name' => 'Example name', // Required. ) );
Basecamp API: Calendars, (*44)
$response = $client->updateCalendar( array( 'calendarId' => 1234567, // Required. Calendar id 'name' => 'Example name', // Required. ) );
Basecamp API: Calendars, (*45)
$response = $client->deleteCalendar( array( 'calendarId' => 1234567, // Required. Calendar id ) );
Basecamp API: Calendar Events, (*46)
$response = $client->getAllCalendarEvents( array( 'start_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) 'end_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) ) );
Basecamp API: Calendar Events, (*47)
$response = $client->getCalendarEvents( array( 'calendarId' => 1234567, // Required. Calendar id 'start_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) 'end_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) ) );
Basecamp API: Calendar Events, (*48)
$response = $client->getCalendarEventsPast( array( 'calendarId' => 1234567, // Required. Calendar id ) );
Basecamp API: Calendar Events, (*49)
$response = $client->getCalendarEvent( array( 'calendarId' => 1234567, // Required. Calendar id 'eventId' => 1234567, // Required. Event id ) );
Basecamp API: Calendar Events, (*50)
$response = $client->createCalendarEvent( array( 'calendarId' => 1234567, // Required. Calendar id 'summary' => 'example', // Required. Event Summary / title 'description' => 'Example description', // Optional. Event Description 'starts_at' => 'example', // Required. Date (and time if not an all day event) that the event starts at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'ends_at' => 'example', // Optional. Date (and time if not an all day event) that the event ends at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'remind_at' => 'example', // Optional. Datetime to remind subscribers about the event via email (format: 2015-09-15T11:50:00-05:00) 'subscribers' => '', // Optional. Array of user id's to subscribe to the event. 'recurring' => '', // Optional. Array of recurring parrameters - starts_at, frequency, count, until, excluding 'all_day' => '', // Optional. Is the event a full day event? ) );
Basecamp API: Calendar Events, (*51)
$response = $client->updateCalendarEvent( array( 'calendarId' => 1234567, // Required. Calendar id 'eventId' => 1234567, // Required. Event id 'summary' => 'example', // Optional. Event Summary / title 'description' => 'Example description', // Optional. Event Description 'starts_at' => 'example', // Optional. Date (and time if not an all day event) that the event starts at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'ends_at' => 'example', // Optional. Date (and time if not an all day event) that the event ends at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'remind_at' => 'example', // Optional. Datetime to remind subscribers about the event via email (format: 2015-09-15T11:50:00-05:00) 'subscribers' => '', // Optional. Array of user id's to subscribe to the event. 'recurring' => '', // Optional. Array of recurring parrameters - starts_at, frequency, count, until, excluding 'all_day' => '', // Optional. Is the event a full day event? ) );
Basecamp API: Calendar Events, (*52)
$response = $client->deleteCalendarEvent( array( 'calendarId' => 1234567, // Required. Calendar id 'eventId' => 1234567, // Required. Event id ) );
Basecamp API: Calendar Events, (*53)
$response = $client->getProjectCalendarEvents( array( 'projectId' => 1234567, // Required. Project ID 'start_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) 'end_date' => 'example', // Optional. Will return 6 weeks worth of events after the start date if the end date is not supplied (format: 2015-09-15) ) );
Basecamp API: Calendar Events, (*54)
$response = $client->getProjectCalendarEventsPast( array( 'projectId' => 1234567, // Required. Project ID ) );
Basecamp API: Calendar Events, (*55)
$response = $client->getProjectCalendarEvent( array( 'projectId' => 1234567, // Required. Project id 'eventId' => 1234567, // Required. Event id ) );
Basecamp API: Calendar Events, (*56)
$response = $client->createProjectCalendarEvent( array( 'projectId' => 1234567, // Required. Project id 'summary' => 'example', // Required. Event Summary / title 'description' => 'Example description', // Optional. Event Description 'starts_at' => 'example', // Required. Date (and time if not an all day event) that the event starts at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'ends_at' => 'example', // Optional. Date (and time if not an all day event) that the event ends at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'remind_at' => 'example', // Optional. Datetime to remind subscribers about the event via email (format: 2015-09-15T11:50:00-05:00) 'subscribers' => '', // Optional. Array of user id's to subscribe to the event. 'recurring' => '', // Optional. Array of recurring parrameters - starts_at, frequency, count, until, excluding 'all_day' => '', // Optional. Is the event a full day event? ) );
Basecamp API: Calendar Events, (*57)
$response = $client->updateProjectCalendarEvent( array( 'projectId' => 1234567, // Required. Project id 'eventId' => 1234567, // Required. Event id 'summary' => 'example', // Optional. Event Summary / title 'description' => 'Example description', // Optional. Event Description 'starts_at' => 'example', // Optional. Date (and time if not an all day event) that the event starts at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'ends_at' => 'example', // Optional. Date (and time if not an all day event) that the event ends at (format: 2015-09-15 or 2015-09-15T11:50:00-05:00) 'remind_at' => 'example', // Optional. Datetime to remind subscribers about the event via email (format: 2015-09-15T11:50:00-05:00) 'subscribers' => '', // Optional. Array of user id's to subscribe to the event. 'recurring' => '', // Optional. Array of recurring parrameters - starts_at, frequency, count, until, excluding 'all_day' => '', // Optional. Is the event a full day event? ) );
Basecamp API: Calendar Events, (*58)
$response = $client->deleteProjectCalendarEvent( array( 'projectId' => 1234567, // Required. Project id 'eventId' => 1234567, // Required. Event id ) );
The following service operations are not (yet) covered by unit tests:, (*59)
The Basecamp API makes it easy for developers to communicate with the 37signals Basecamp platform
MIT
api basecamp 37signals