PHPackages                             jyokum/healthgraph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. jyokum/healthgraph

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jyokum/healthgraph
==================

PHP wrapper for the RunKeeper Health Graph API built on Guzzle

0.3.0(12y ago)52942[1 issues](https://github.com/jyokum/healthgraph/issues)GPL-2.0PHPPHP &gt;=5.3.2

Since Dec 1Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jyokum/healthgraph)[ Packagist](https://packagist.org/packages/jyokum/healthgraph)[ Docs](https://github.com/jyokum/healthgraph)[ RSS](/packages/jyokum-healthgraph/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d4d46b12f95476049a8e9159ffb204af2345cafad2d85da14ea4c348f4c74d9a/68747470733a2f2f706f7365722e707567782e6f72672f6a796f6b756d2f6865616c746867726170682f762f737461626c652e706e67)](https://packagist.org/packages/jyokum/healthgraph)[![Total Downloads](https://camo.githubusercontent.com/b86d51dab62d05415720d285443062990e10087790e8a21772dccd35bcfa80b2/68747470733a2f2f706f7365722e707567782e6f72672f6a796f6b756d2f6865616c746867726170682f646f776e6c6f6164732e706e67)](https://packagist.org/packages/jyokum/healthgraph)[![Build Status](https://camo.githubusercontent.com/fe7db1f26f5a96e5f6d8ce89d677dbe9e41e30175ce64bd441b86cee5f0d136d/68747470733a2f2f7472617669732d63692e6f72672f6a796f6b756d2f6865616c746867726170682e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/jyokum/healthgraph)

Health Graph Client
===================

[](#health-graph-client)

The Health Graph Client is a PHP wrapper for the Health Graph API

### Installation via Composer

[](#installation-via-composer)

Add HealthGraph in your composer.json:

```
{
    "require": {
        "jyokum/healthgraph": "*"
    }
}
```

Download the library:

```
$ php composer.phar update
```

After installing, you need to require Composer's autoloader somewhere in your code:

```
require_once 'vendor/autoload.php';
```

### Generating a Connect link/button

[](#generating-a-connect-linkbutton)

```
require_once 'vendor/autoload.php';
use HealthGraph\Authorization;

$client_id = 'xxxxxxxxxxxxxxxxxxxxx';
$redirect_url = 'http://example.com/authorize';

// Link
$link = Authorization::getAuthorizationLink($client_id, $redirect_url);
echo "Connect";

// Button
$button = Authorization::getAuthorizationButton($client_id, $redirect_url);
echo $button['html'];
```

### Obtain a token from an auth code

[](#obtain-a-token-from-an-auth-code)

```
require_once 'vendor/autoload.php';
use HealthGraph\Authorization;

$client_id = 'xxxxxxxxxxxxxxxxxxxxx';
$client_secret = 'xxxxxxxxxxxxxxxxxxxxx';
$redirect_url = 'http://example.com/authorize';

if (isset($_REQUEST['code'])) {
    $token = Authorization::authorize($_GET['code'], $client_id, $client_secret, $redirect_url);
    some_function_to_save_the_token($token);
}
```

### Revoke a token

[](#revoke-a-token)

```
require_once 'vendor/autoload.php';
use HealthGraph\Authorization;

$token = some_function_to_retrieve_the_token();
Authorization::deauthorize($token->access_token);
```

### Retrieve data for a user

[](#retrieve-data-for-a-user)

```
require_once 'vendor/autoload.php';
use HealthGraph\HealthGraphClient;

$token = some_function_to_retrieve_the_token();

$hgc = HealthGraphClient::factory();
$hgc->getUser(array(
    'access_token' => $token['access_token'],
    'token_type' => $token['token_type'],
));

// get profile
$hgc->GetProfile();

// get settings
$hgc->GetSettings();

// get fitness activity list
$activities = $hgc->FitnessActivityFeed()->getAll();
```

### Update profile

[](#update-profile)

```
$hgc = HealthGraphClient::factory();
$hgc->getUser(array(
    'access_token' => $token['access_token'],
    'token_type' => $token['token_type'],
));
$data = array('athlete_type' => 'Athlete');
$hgc->UpdateProfile($data);
```

### Get fitness activities

[](#get-fitness-activities)

```
$hgc = HealthGraphClient::factory();
$hgc->getUser(array(
    'access_token' => $token['access_token'],
    'token_type' => $token['token_type'],
));

// Get the entire feed, this could return a lot of data.
$command = $hgc->getIterator('GetFitnessActivityFeed');
$result = $command->toArray();

// Get the 5 most recent activities.
$command = $hgc->getIterator('GetFitnessActivityFeed')->setLimit(5);
$result = $command->toArray();
```

### Add a new fitness activity

[](#add-a-new-fitness-activity)

```
$hgc = HealthGraphClient::factory();
$hgc->getUser(array(
    'access_token' => $token['access_token'],
    'token_type' => $token['token_type'],
));
$command = $hgc->getCommand('NewFitnessActivity', array(
    "type" => "Running",
    "start_time" => "Sat, 1 Jan 2011 00:00:00",
    "duration" => 600,
    "total_distance" => 1000,
    "notes" => "Ran 1000 meters in 600 seconds"
));
$result = $command->execute();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

3

Last Release

4560d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.2.0PHP &gt;=5.3.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1894851?v=4)[Jeff Yokum](/maintainers/jyokum)[@jyokum](https://github.com/jyokum)

---

Top Contributors

[![jyokum](https://avatars.githubusercontent.com/u/1894851?v=4)](https://github.com/jyokum "jyokum (51 commits)")

---

Tags

GuzzlerunkeeperHealth Graph

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jyokum-healthgraph/health.svg)

```
[![Health](https://phpackages.com/badges/jyokum-healthgraph/health.svg)](https://phpackages.com/packages/jyokum-healthgraph)
```

###  Alternatives

[bradfeehan/desk-php

PHP client for Desk.com v2 API based on Guzzle

2181.4k](/packages/bradfeehan-desk-php)[cossou/trak-io-api-client

PHP Trak.io Api Client built on Guzzle

204.0k](/packages/cossou-trak-io-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
