-# Todoist SDK for PHP — An unofficial Todoist API library**This repository contains the open source PHP SDK which allows you to access the Todoist API from your PHP application.**[](https://github.com/FabianBeiner/Todoist-PHP-SDK/tags) * [](https://github.com/FabianBeiner/Todoist-PHP-SDK/stargazers) * [](https://github.com/FabianBeiner/Todoist-PHP-SDK/issues) * [](https://github.com/FabianBeiner/Todoist-PHP-SDK/blob/master/LICENSE) * [](https://www.codacy.com/app/FabianBeiner/Todoist-PHP-SDK?utm_source=github.com&utm_medium=referral&utm_content=FabianBeiner/Todoist-PHP-SDK&utm_campaign=Badge_Grade)## Requirements- PHP: 5.5+- guzzlehttp/guzzle: 6.3+- ramsey/uuid: 3.7+## InstallationThe Todoist SDK for PHP can be installed with [Composer](https://getcomposer.org/). Run this command:```bashcomposer require fabian-beiner/todoist-php-sdk```## Obtaining your personal API tokenOpen the [Todoist web app](https://todoist.com), click on the gear icon, select “Settings”, then “Integrations”. Your API token is visible on the bottom of this page.## Usage```php<?phprequire __DIR__ . '/vendor/autoload.php';$Todoist = new FabianBeiner\Todoist\Todoist('YOUR_API_TOKEN');```## Methods & Examples### Get all projects```php$allProjects = $Todoist->getAllProjects();``````print_r($allProjects);( [0] => stdClass Object ( [id] => 123456789 [name] => Inbox [order] => 0 [indent] => 1 [comment_count] => 0 ) [1] => stdClass Object ( [id] => 987654321 [name] => Project [order] => 1 [indent] => 1 [comment_count] => 0 ) …)```### Create a new project```php$createProject = $Todoist->createProject('Example Project');``````print_r($createProject);stdClass Object( [id] => 123454321 [name] => Example Project [order] => 2 [indent] => 1 [comment_count] => 0)```### Get a project```php$project = $Todoist->getProject('123454321');``````print_r($project);stdClass Object( [id] => 123454321 [name] => Example Project [order] => 2 [indent] => 1 [comment_count] => 0)```### Update (actually rename…) a project```php$Todoist->updateProject('123454321', 'New Project Name');``````print_r($Todoist->updateProject('123454321', 'New Project Name'));1```### Delete a project```php$Todoist->deleteProject('123454321');``````print_r($Todoist->deleteProject('123454321'));1```### Get all labels```php$allLabels = $Todoist->getAllLabels();``````print_r($allLabels);( [0] => stdClass Object ( [id] => 12121212 [name] => LabelName [order] => 1 ) [1] => stdClass Object ( [id] => 34343434 [name] => Another_Label [order] => 2 ) …)```### Create a new label```php$createLabel = $Todoist->createLabel('Example Label');``````print_r($createLabel);stdClass Object( [id] => 555888999 [name] => Example_Label [order] => 3)```### Get a label```php$label = $Todoist->getLabel('555888999');``````print_r($project);print_r($label);stdClass Object( [id] => 555888999 [name] => Example_Label [order] => 3)```### Update (actually rename…) a label```php$Todoist->updateProject('555888999', 'New Label Name');``````print_r($Todoist->renameLabel('555888999', 'New Label Name'));1```### Delete a label```php$Todoist->deleteLabel('555888999');``````print_r($Todoist->deleteLabel('555888999'));1```## ContributingI’d be happy if you contribute to this library. Please try to follow theexisting coding style and use proper comments in your commit message.
0 commit comments