Git Product home page Git Product logo

beeminder-php-api's Introduction

Beeminder API

A PHP interface to the Beeminder API. Handles everything in v1, although it still needs much better error handling.

Usage

First you'll need to include the autoloader using the following snippet:

require_once '/path/to/lib/Beeminder/Autoloader.php';
Beeminder_Autoloader::register();

Just replace /path/to/ with the actual path the API is stored in.

Once the autoloader is included and setup, it's time to create an instance of Beeminder_Client. After that, simply login using authorisation tokens (either OAuth or the private API token) and then call whatever method(s) you want. Here's an example:

// Include the autoloader
require_once dirname(__FILE__) . '/vendor/beeminder-api/lib/Beeminder/Autoloader.php';
Beeminder_Autoloader::register();

// Create new client
$api = new Beeminder_Client();

// Setup auth (private token)
$api->login('username', 'secret_token', Beeminder_Client::AUTH_PRIVATE_TOKEN);

// Fetch a list of goals for the user
$goals = $api->getGoalApi()->getGoals();

// Output some happy info
foreach ($goals as $goal) {
    echo "{$goal->title}\n";
    echo "{$goal->goal_type}\n";
}

Questions

How do I check which version I have?

echo Beeminder_Client::VERSION

If this gives an error like PHP Fatal error: Undefined class constant 'VERSION', then you are using an older obsolete release and it's best to download the lastest version.

Development

beeminder-php-api uses the PHPUnit testing framework and has 100% test coverage.

###Running the tests

phpunit -c test/phpunit.xml --coverage-text

Projects that use this library

  • beeminder-ping -- A WordPress plugin to ping Beeminder when a post is made.

Credits

beeminder-php-api's People

Contributors

dreeves avatar insti avatar mikepsinn avatar sodaware avatar

Watchers

 avatar  avatar

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.