PHP code example of iamstuartwilson / strava

1. Go to this page and download the library: Download iamstuartwilson/strava library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

iamstuartwilson / strava example snippets


$accessToken = $result->access_token;
$refreshToken = $result->refresh_token;
$expiresAt = $result->expires_at;
 php
pi = new Iamstuartwilson\StravaApi(
    $clientId,
    $clientSecret
);
 php
$api->authenticationUrl($redirect, $approvalPrompt = 'auto', $scope = null, $state = null);
 php
$result = $api->tokenExchange($code);
 php
$api->setAccessToken($accessToken, $refreshToken, $expiresAt);
 php
$api->get('athletes/:id/stats');
 php
$api->get(
    'athlete/activities',
    [
        'page' => 2,
        'per_page' => 10,
    ]
);
 php
$api->put('athlete', ['weight' => 70]);