Code Monkey home page Code Monkey logo

php-rtm's Introduction

Remember The Milk API client for PHP

Build Status

Basic information

This library is created to simplify communication with Remember The Milk API. It provides simple, object-oriented interface for PHP programmers. For list of Remember The Milk API methods see here. Each group of methods has its own service class located in src/Rtm/Service/ directory.

Installation

The easiest way to start using php-rtm library is to add it as requirement to your composer.json file:

"bartosz-maciaszek/php-rtm": "dev-master"

And update your composer dependencies.

Alternatively, you can clone this repo manually:

git clone git://github.com/bartosz-maciaszek/php-rtm.git

Basic usage

To call any method from API you simply need to create Rtm class instance and service object and then push some basic information like your API key and secret. Additionally, you need to acquire Auth Token from Remember The Milk. To do that, user has to authorize your app. See sample-app/rtm.php file for details, it is explained step by step.

<?php

use Rtm\Rtm;

$rtm = new Rtm;
$rtm->setApiKey('Your API key');
$rtm->setSecret('Your secret');
$rtm->setAuthToken('Your Auth Token from RTM');

$taskService = $rtm->getService(Rtm::SERVICE_TASKS);
$taskList = $taskService->getList();

Response from API is wrapped in handy class Rtm\DataContainer which gives you ability to make method chains like $response->getUser()->getName() as it supports recurrency. To review its code and unit tests see src/Rtm/DataContainer.php and tests/RtmTest/DataContainerTest.php. You can easily convert this object into an array or json string by invoking toArray() or toJson() method, respectively.

Unit tests

All unit tests are located in tests/ directory. You can run them all by invoking command phpunit in main directory (where phpunit.xml is located) or individually, by invoking phpunit tests/path/to/test/class, eg. phpunit tests/RtmTest/RtmTest.php.

Sample application

Sample application that uses this library is available in sample-app/ directory.

php-rtm's People

Contributors

bartosz-maciaszek avatar

Watchers

 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.