PHP code example of tai-sho / oura-api-php

1. Go to this page and download the library: Download tai-sho/oura-api-php 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/ */

    

tai-sho / oura-api-php example snippets




use OuraApiPhp\Client;

$accessToken = 'your-access-token';
$client = new Client($accessToken);

$params = ['start_date' => '2024-01-01', 'end_date' => '2024-01-07'];
$response = $client->getHeartRate($params);
$data = json_decode($response->getBody()->getContents(), true);
print_r($data);

$response = $client->getPersonalInfo();
$data = json_decode($response->getBody()->getContents(), true);
print_r($data);


$params = ['start_date' => '2024-01-01', 'end_date' => '2024-01-07'];
$response = $client->getWorkout($params);
$data = json_decode($response->getBody()->getContents(), true);
print_r($data);

$params = ['start_date' => '2024-01-01', 'end_date' => '2024-01-07'];
$responses = $client->getAllHeartRateData($params);
foreach ($responses as $response) {
    $data = json_decode($response->getBody()->getContents(), true);
    print_r($data);
}

bash
$ composer