Wallogit.com
2017 © Pedro Peláez
A php wrapper for working with Strava's V3 API.
A php wrapper for Strava's API (version 3)., (*1)
Strava, (*2)
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)
/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).
));
?>
<?php
$strava->requestAccess();
?>
See example.php for a full working example., (*4)
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)
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)
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)
Copyright (c) 2013 - Chris Sprague Released under the GPL License., (*11)