A PHP client library for the Oura Ring API.
- PHP 7.4 or higher
- Composer
- Oura Personal Access Token (see below for more information)
You can install the library via Composer. Run the following command:
$ composer require tai-sho/oura-api-php
This library requires a personal access token to authenticate with the Oura API. You can obtain a personal access token from the Oura page: Oura API Doc
First, you need to initialize the client with your API access token.
require 'vendor/autoload.php';
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);
}
The client supports the following endpoints:
getHeartRate(array $params = [])
getPersonalInfo(array $params = [])
getTag(array $params = [])
getEnhancedTag(array $params = [])
getWorkout(array $params = [])
getSession(array $params = [])
getDailyActivity(array $params = [])
getDailySleep(array $params = [])
getDailySpo2(array $params = [])
getDailyReadiness(array $params = [])
getSleep(array $params = [])
getSleepTime(array $params = [])
getRestModePeriod(array $params = [])
getRingConfiguration(array $params = [])
getDailyStress(array $params = [])
getTagById(string $documentId, array $params = [])
getEnhancedTagById(string $documentId, array $params = [])
getWorkoutById(string $documentId, array $params = [])
getSessionById(string $documentId, array $params = [])
getDailyActivityById(string $documentId, array $params = [])
getDailySleepById(string $documentId, array $params = [])
getDailySpo2ById(string $documentId, array $params = [])
getDailyReadinessById(string $documentId, array $params = [])
getSleepById(string $documentId, array $params = [])
getSleepTimeById(string $documentId, array $params = [])
getRestModePeriodById(string $documentId, array $params = [])
getRingConfigurationById(string $documentId, array $params = [])
getDailyStressById(string $documentId, array $params = [])
getAllHeartRateData(array $params = [])
getAllWorkoutData(array $params = [])
getAllTagData(array $params = [])
getAllEnhancedTagData(array $params = [])
getAllSessionData(array $params = [])
getAllDailyActivityData(array $params = [])
getAllDailySleepData(array $params = [])
getAllDailySpo2Data(array $params = [])
getAllDailyReadinessData(array $params = [])
getAllSleepData(array $params = [])
getAllSleepTimeData(array $params = [])
getAllRestModePeriodData(array $params = [])
getAllRingConfigurationData(array $params = [])
getAllDailyStressData(array $params = [])
Welcome contributions! Please submit a pull request or open an issue to discuss changes.
This project is licensed under the MIT License. See the LICENSE file for details.