1. Go to this page and download the library: Download schmunk42/php-bcx-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
schmunk42 / php-bcx-client example snippets
use Schmunk42\BasecampApi\Authentication\BasicAuthentication;
use Schmunk42\BasecampApi\Client\BasecampClient;
// Your Basecamp credentials
$accountId = '999999999'; // Your account ID
$username = '[email protected]'; // Your Basecamp email
$password = 'your-password'; // Your Basecamp password
// Create authenticated client
$auth = new BasicAuthentication($username, $password);
$client = new BasecampClient($accountId, $auth);
// Get all projects
$projects = $client->projects()->all();
// Get current user
$me = $client->people()->me();
echo "Logged in as: {$me['name']}\n";
use Schmunk42\BasecampApi\Authentication\OAuth2Authentication;
use Schmunk42\BasecampApi\Client\BasecampClient;
// OAuth 2.0 access token (obtained through OAuth flow)
$accessToken = 'BAhbByIBsHsidmVyc2lvbiI6MSwidXNlcl9pZCI...';
$accountId = '999999999';
// Create authenticated client
$auth = new OAuth2Authentication($accessToken);
$client = new BasecampClient($accountId, $auth);
// Use the API
$projects = $client->projects()->all();
// List all projects
$projects = $client->projects()->all();
// Get archived projects
$archived = $client->projects()->archived();
// Create a new project
$project = $client->projects()->create([
'name' => 'New Project',
'description' => 'Project description',
]);
// Archive a project
$client->projects()->delete(123456);
// Get all todolists in a project
$todolists = $client->todolists()->all($projectId);
// Get todos in a todolist
$todos = $client->todos()->all($projectId, $todolistId);
// Get all todos across all todolists in a project
$allTodos = $client->todos()->allInProject($projectId);
// Filter todos by due date
$upcomingTodos = $client->todos()->allInProject($projectId, '2025-01-01');
// Get completed/remaining/trashed todos
$completed = $client->todos()->getCompleted($projectId, $todolistId);
$remaining = $client->todos()->getRemaining($projectId, $todolistId);
$trashed = $client->todos()->getTrashed($projectId, $todolistId);
// Project-level queries
$allCompleted = $client->todos()->getAllCompletedInProject($projectId);
$allRemaining = $client->todos()->getAllRemainingInProject($projectId);
// Create a new todo
$todo = $client->todos()->create($projectId, $todolistId, [
'content' => 'Task description',
'due_at' => '2025-12-31',
]);
// Mark todo as complete
$client->todos()->complete($projectId, $todoId);
// Global todolist queries
$activeLists = $client->todolists()->allGlobal();
$completedLists = $client->todolists()->getCompletedGlobal();
$trashedLists = $client->todolists()->getTrashedGlobal();
// Get todolist with many items (1000+) - excludes todos for performance
$largeTodolist = $client->todolists()->get($projectId, $todolistId, true);
// Get current user
$me = $client->people()->me();
// Get all people
$people = $client->people()->all();
// Get specific person
$person = $client->people()->get($personId);
// Get person's assigned todos across all projects
$assignedTodos = $client->people()->getAssignedTodos($personId);
// Filter assigned todos by due date
$upcomingTasks = $client->people()->getAssignedTodos($personId, '2025-01-01');
// Get person's activity events
$events = $client->people()->getEvents($personId);
// Get all projects accessible to a person
$projects = $client->people()->getProjects($personId);
// Get trashed (deleted) users (admin only)
$trashedUsers = $client->people()->getTrashed();
// Create a message
$message = $client->messages()->create($projectId, [
'subject' => 'Project Update',
'content' => 'Here is the latest update...',
]);
// Add a comment to a message
$comment = $client->comments()->create(
$projectId,
'Message',
$messageId,
['content' => 'Great update!']
);
$auth = new BasicAuthentication('[email protected]', 'password');
$client = new BasecampClient('999999999', $auth); // Try any number first
$me = $client->people()->me(); // Will show your accounts
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$logger = new Logger('basecamp');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));
$client = new BasecampClient($accountId, $auth, null, $logger);
// All API requests will be logged
$projects = $client->projects()->all();
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.