2017 © Pedro Peláez
 

library strava-v3

A php wrapper for working with Strava's V3 API.

image

badmushroom/strava-v3

A php wrapper for working with Strava's V3 API.

  • Friday, April 18, 2014
  • by bad-mushroom
  • Repository
  • 2 Watchers
  • 5 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Strava PHP V3 API


About

A php wrapper for Strava's API (version 3)., (*1)

Strava, (*2)

Requirements

  • PHP 5.3.0 or higher
  • cURL Library
  • JSON Library
  • Registered Strava App/API Key (http://www.strava.com/developers)

Getting started

You'll need to [register] (http://www.strava.com/developers) your app with strava first. In exchange you'll get an OAuth Client ID, Secret Key, Access, Key, etc., (*3)

Initialize the class

/stravaV3/strava.php';

    $strava = new \stravaV3\Strava(array(
        'accessToken'  => '',
        'secretToken' => '',
        'clientID' => ,
        'redirectUri' => 'http://example.com/strava', // You can use http://localhost during testing
        'cacheDir' => ', // Must be writable by your web server
        'cacheTtl' => 900 // Numbder of seconds the cache file is good for (900 = 15 minutes).
    ));

?>

Authenticate (OAuth2)

<?php
    $strava->requestAccess();
?>

See example.php for a full working example., (*4)

Methods

The only method (at this time) that you'll call is the makeApiCall() method., (*5)

<?php
    $athlete = $strava->makeApiCall('athlete');
    var_dump($athlete);
?>

makeApiCall() takes three arguments argument: Function, Method, Parameters., (*6)

  • Function (required): the type of information to return. See API Docs
  • Parameters (optional): An array of additional parameters See API Docs
  • Method (optional): get or post (delete, put, head are not yet supported). Default is 'get'.

All data is returned in JSON format. Since we're limited to the number of calls we can make in a 15 minute period, makeApiCall() will automatically look for a cached version of the data before contacting Strava. If a valid cache doesn't exist the method will save the response from Strava as a serialized, JSON decoded string to be used in subsequent requests., (*7)

History

StravaV3 0.2.1 - 2013-12-25 - PSR-0, (*8)

StravaV3 0.2.0 - 2013-11-30 - Added response caching - Added check for 401 header - Fixed bug that caused $api_url to be malformed when passing a parameters array, (*9)

StravaV3 0.1.0 - 2013-11-28 - Initial release, (*10)

Credits

Copyright (c) 2013 - Chris Sprague Released under the GPL License., (*11)

The Versions

18/04 2014

dev-master

9999999-dev

A php wrapper for working with Strava's V3 API.

  Sources   Download

GPL3

The Requires

  • php >=5.3.0

 

by Chris Sprague

15/04 2014

dev-dev

dev-dev

A php wrapper for working with Strava's V3 API.

  Sources   Download

GPL3

The Requires

  • php >=5.3.0

 

by Chris Sprague