PHP wrapper library for Moves API

1.1.0 2014-03-16 09:58 UTC

This package is not auto-updated.

Last update: 2024-12-17 03:09:38 UTC


README

Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version

moves-api-php

PHP client for Moves API.

Inspired by moves Ruby Gem.

Installation

Recommend way to install this package with Composer. Add borivojevic/moves-api-php to your composer.json file.

{
    "require": {
        "borivojevic/moves": "1.1.0"
    }
}

To install composer run:

curl -s http://getcomposer.org/installer | php

To install composer dependences run:

php composer.phar install

You can autoload all dependencies by adding this to your code:

require 'vendor/autoload.php';

Usage

The main entry point of the library is the Moves\Moves class. API methods require to be signed with valid access token parameter which you have to provide as a first argument of the constructor.

$Moves = new \Moves\Moves($accessToken);

Get Profile

$Moves->profile();

Daily summaries

$Moves->dailySummary(); # current day
$Moves->dailySummary('2013-11-20'); # any day
$Moves->dailySummary('2013-W48'); # any week
$Moves->dailySummary('2013-11'); # any month

# Date range - max 31 days
$Moves->dailySummary('2013-11-10', '2013-11-20');
$Moves->dailySummary(array('from' => '2013-11-10', 'to' => '2013-11-20'));

$Moves->dailySummary(array('pastDays' => 3)); # past 3 days

# also supports DateTime objects
$Moves->dailySummary(new DateTime('2013-11-20'));
$Moves->dailySummary(new DateTime('2013-11-10'), new DateTime('2013-11-20'));
$Moves->dailySummary(array('from' => new DateTime('2013-11-10'), 'to' => new DateTime('2013-11-20')));

Daily activities

$Moves->dailyActivities(); # current day
$Moves->dailyActivities('2013-11-20'); # any day
$Moves->dailyActivities('2013-W48'); # any week

# Date range - max 7 days
$Moves->dailyActivities('2013-11-10', '2013-11-20');
$Moves->dailyActivities(array('from' => '2013-11-10', 'to' => '2013-11-20'));

$Moves->dailyActivities(array('pastDays' => 3)); # past 3 days

Daily places

$Moves->dailyPlaces(); # current day
$Moves->dailyPlaces('2013-11-20'); # any day
$Moves->dailyPlaces('2013-W48'); # any week

# Date range - max 7 days
$Moves->dailyPlaces('2013-11-10', '2013-11-20');
$Moves->dailyPlaces(array('from' => '2013-11-10', 'to' => '2013-11-20'));

$Moves->dailyPlaces(array('pastDays' => 3)); # past 3 days

Daily storyline

$Moves->dailyStoryline(); # current day
$Moves->dailyStoryline('2013-11-20'); # any day
$Moves->dailyStoryline('2013-W48'); # any week

# Date range - max 7 days
$Moves->dailyStoryline('2013-11-10', '2013-11-20');
$Moves->dailyStoryline(array('from' => '2013-11-10', 'to' => '2013-11-20'));

$Moves->dailyStoryline(array('pastDays' => 3)); # past 3 days

# Get daily storyline with track points
$Moves->dailyStoryline(array('trackPoints' => 'true'));
$Moves->dailyStoryline('2013-11-10', array('trackPoints' => 'true'));

Versioning

The library uses Semantic Versioning

Copyright and License

The library is licensed under the MIT license.