Skip to content
PHP library for parsing cycling GPS activities and calculating metrics.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Endurance
tests
.gitignore
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Endurance

Endurance is a PHP library for parsing cycling GPS activities and calculating metrics.

Usage

Parse TCX files from Garmin devices

<?php

use Endurance\TCXParser;

$parser = new TCXParser();
$activity = $parser->parse('/path/to/activity.tcx');

Calculate useful metrics

<?php

use Endurance\Calculator\HeartRateZoneCalculator;
use Endurance\Calculator\MetricCalculator;
use Endurance\Metric\AverageMovingSpeedMetric;

$zoneCalculator = new HeartRateZoneCalculator();
$zones = $zoneCalculator->calculateZones(182);

$metricCalculator = new MetricCalculator();
$metrics = $metricCalculator->calculate(array(
    'averageMovingSpeed' => new AverageMovingSpeedMetric()
), $activity->getPoints(), $zones);

// Returns an associative array of the calculated metric values
// $metrics = ['averageMovingSpeed' => 26.43]

Running the Tests

Setup the vendor directory

$ cd endurance
$ php composer.phar install --dev

Launch the test suite

In the root directory:

$ phpunit

Is it green?

You can’t perform that action at this time.