A fork of php-garmin-connect that allows to display your personal records year by year on running races.
It's a quick & dirty but functional work! See the online demo
Create a .env file with the followings:
GARMIN_SINCE=2017
GARMIN_USERNAME=your@email.tld
GARMIN_PASSWORD=your-password
GARMIN_SINCEdescribes the first year from which you want to request data (e.g from 2017 to current year).GARMIN_USERNAME&GARMIN_PASSWORDare just your Garmin credentials (Garmin Connect).
Run composer install to install dependencies and open index.php on a browser.
The first display could take a moment, especially if you want to grab many years/distances.
Then, data are cached in data/records.json to avoid unnecessary Garmin's crawls (use query string ?refresh param to flush cache, see Tweak section).
It'll make a request on Garmin Connect for each year and distance (+/-2%) you want to collect and take the best time effort, that's it!
We also collect some other useful data including:
id: the id of your activity (https://connect.garmin.com/modern/activity/{id})date: the start date of the race (yyyy-mm-dd hh:mm:ss)distance: the exact distance traveled (in meters)time: the formatted duration (hh"mm'ss or mm'ss if shorter than an hour)pace: the formatted average pace (mm'ss per 1 kilometer)speed: the average speed (km/h)cals: calories burnedhr: the average heart rate (bpm)cadence: the feet pace (per minute)
{
"42200": {
"2021": {
"duration": 10633.774002075195,
"data": {
"id": 6702582078,
"date": "2021-05-01 09:00:00",
"distance": 42410,
"time": "02\"57'13",
"pace": "04'10",
"speed": 14.4,
"cals": 2668,
"hr": 167,
"cadence": 189
}
}
}
}The page displays:
Personal best of all time.
A chart with your personal records grouped by year on all the classic distances (5k, 10k, half & marathons).
It also displays a summary with more data for all events.
If you want to remove/add some distances, feel free to edit these lines:
labelis the human label used to describe the race distancecolor.aliasis the Boostrap color class used on cards "Personal Best" section.color.hexis the hexadecimal value used on the chart (could be the same thanBootstrapbut not necessary).
If you want to refresh data:
?refreshto force refresh current year?refresh=allto force refresh all years
All credits to David Wilcock for his great library, I only adapted this one to allow searching on specific filters (not possible on the base solution) and collected/aggregated data.


