Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

McGo/trainingstats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

14 Commits

Repository files navigation

Build Status

Trainingstats

PHP package to gather metrics and calculate statistics from a training TCX file.

Installation

Simply install the package via composer or drop it in manually and add the autoloader.

Usage

There are two classes that are important to be aware of. The parsing is done by TCXParser() which leads to an object that stores activities and the accoring data. You could use the second Class Calculation() on the parsers activity then to check details.

Parse a tcx file

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

Calculate details from the parser object

$activities = $parser->getActivities();
foreach ($activities as $activity) {
 $calculation = new Calculation($activity);
 try {
 $details = $calculation->calculateBasicDetails();
 $splits = $calculation->calculateSplits();
 $laps = $calculation->calculateLapDetails();
 $distances = $calculation->calculateBestDistances();
 $times = $calculation->calculateBestTimes();
 }
 catch (ActivityIsNotSetException $e) {
 // Do what you want to do if the file is tcx but has no activities
 }
 catch (FileIsNoTCXFileException $e) {
 // Handle the situation when the file is not a tcx file
 }
}

To Do

  • Documentation
  • Add Heartratezone calculation
  • Add kcal calculation

About

PHP package to gather metrics and calculate statistics from a training TCX file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /