Giter VIP home page Giter VIP logo

todoist-php-api-library's Introduction

GitHub tag (latest by date) GitHub stars GitHub forks GitHub issues GitHub license Codacy grade StyleCI Badge

PHP Client for Todoist

This repository contains a PHP client library that provides a native interface to the official Todoist REST API (v2).

Requirements

Installation

The recommended way is using Composer. If you don’t have Composer installed, follow the installation instructions.

Once you have installed Composer, execute the following command in your project root to install this library:

composer require fabian-beiner/todoist-php-api-library

Finally, include the autoloader in your project:

require __DIR__ . '/vendor/autoload.php';

Usage

$Todoist = new FabianBeiner\Todoist\TodoistClient('YOUR_API_TOKEN');

Please look at the Wiki of this project. It contains a list of all available methods and related usage examples.

Obtain your API token

Click here to find your API token at the bottom of that page.

If the link doesn’t work, open the Todoist web app, click on your profile image/icon, select “Settings,” then “Integrations.”

Changelog

👉 CHANGELOG.md

Contributing

I’d be happy if you contributed to this library. Please follow the existing coding style and use proper comments in your commit message. Thanks! 🙇

License

👉 LICENSE

Disclaimer

The project is not created by, affiliated with, or supported by Doist. 😢

todoist-php-api-library's People

Contributors

balazscsaba2006 avatar dependabot[bot] avatar dvdheiden avatar fabianbeiner avatar goldcarrotyamil avatar judzi avatar valkyrie00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todoist-php-api-library's Issues

405 Method Not Allowed

Hi

From the API docs the close task and reopen task methods are expecting a post method, but the get method is being used instead, so it is returning a 405 Method Not Allowed error.

I am putting together a quick pull request for this as well.

Regards
Alan

FILTER_SANITIZE_STRING constant is deprecated in PHP 8.1

This constant is currently used in, for example, the TodoistSectionsTrait. The FILTER_SANITIZE_STRING is deprecated in PHP 8.1:

Deprecated as of PHP 8.1.0, use htmlspecialchars() instead.

Source: https://www.php.net/manual/en/filter.filters.sanitize.php

But when I look at the documentation of the FILTER_SANITIZE_STRING it does:

Strip tags and HTML-encode double and single quotes, optionally strip or encode special characters.

So the suggested replacement has a different behavior as htmlspecialchars does not strip the tags.

I can create a PR, but want to discuss the solution first. I think in this case a strip_tags might be sufficient, but then the "HTML-encode double and single quotes" is missing. What do you think?

Sync API plans?

Wondering if you are planning to implement any Sync API endpoints here. e.g. when creating a project with the REST API, one can't set the indent, etc., so subprojects are basically impossible. I assume Todoist will improve the REST API before they release it, but was just curious.

Hi, thanks for the amazing library. I am running into the following error: Fatal error: Uncaught Error: Class 'FabianBeiner\Todoist' not found

Heads up!

I appreciate any bug report or other contributions, but please remember that this issue tracker is only for the client library.

I do not maintain the API that this library talks to, nor am I affiliated with Todoist at all. 😞 If you have any issues or questions about the API itself, please have a look at the official documentation.

Thanks! 🙌

Unable to manipulate curl

the change to the signature of TodoistClient constructor messed with my setup:

I suppress the ssl verification when running in debug mode. This is because when running the app on my local machine, the SSL will always fail and curl returns

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

I use it like this:

new TodoistClient($serviceCode->access_token, ['verify' => !env('APP_DEBUG', false)]);

I would like to propose to have the $config = [] from version < 1.0 as the 3rd argument to the constructor.
7e95c16#diff-aec6dcf89dc5fd658ec91e8310e54ad6de5c9f2da70a8c65db615ff38a8b7625L44-R56

The code example on readme.md is wrong

Code example on readme.md is wrong.

I get this error:
PHP Fatal error: Uncaught Error: Class 'FabianBeiner\Todoist\Todoist' not found

So the code on readme.md is this:
$Todoist = new FabianBeiner\Todoist\Todoist('YOUR_API_TOKEN');
Should be this:
$Todoist = new FabianBeiner\Todoist\TodoistClient('YOUR_API_TOKEN');

Maybe tweak the readme, otherwise great work and thank you!

Exceptions - 401 in particular

Hello.

first of all, thank you for this package! cool stuff :-)

I got to the point where I am implementing the exceptions of the APIs I am using.
But I am now stuck with the problem:

How can I identify if the case where the access_token was invalidated?

For the other APIs I am consuming, I am checking for 401 responses.
What is the recommended way here?

if (!$client->getAllProjects()) {
  removePairing();
}

I was expecting something more in the likes of

try {
    $client->getAllProjects();
} catch (\FabianBeiner\Todoist\ResponseForbidden $e) {
    removePairing();
}

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.