sportlog/fit
Composer 安装命令:
composer require sportlog/fit
包简介
A decoder for FIT files
README 文档
README
A PHP (>= PHP 8) decoder for FIT files created by Garmin devices. The result is a list of all messages decoded from the file. Each message is an instance of its underlying message class, so you can easily access any (native) fields using intellisense. (FIT SDK 21.201)
Install via Composer
You can install sportlog/FIT using Composer.
$ composer require sportlog/fit
Minimum PHP version required is 8.
There are two functions for decoding
- read: requires the file as parameter and returns an instance of MessageList, which holds all decoded messages.
- stream: requires the file and a callback as parameter, which receives each decoded message. Returns void to reduce memory consumption.
How to use
<?php require 'vendor/autoload.php'; use Sportlog\FIT\Decoder; use Sportlog\FIT\Profile\Messages\SessionMessage; use Sportlog\FIT\Profile\Types\MesgNum; $decoder = new Decoder(); // Decoding the FIT file returns a set of messages $messageList = $decoder->read('yourfile.fit'); echo "File type: " . $messageList->getFileType(); // You can iterate over the message list, or like in this example, // iterate over the messages grouped by their message numbers. foreach ($messageList->getMessageNumbers() as $messageNumber) { $messages = $messageList->getMessages($messageNumber); echo sprintf('%s: %s', $messageNumber, count($messages)); } // You can also grab specific messages $sessionMessages = $messageList->getMessages(MesgNum::SESSION); // There should be one session message (add check!) /** @var SessionMessage $sessionMessage */ $sessionMessage = $sessionMessages[0]; // get any native fields from the message; use intellisense echo "Total time (m): " . $sessionMessage->getTotalElapsedTime(); echo "Total distance (m): " . $sessionMessage->getTotalDistance(); echo "Total ascent (m): " . $sessionMessage->getTotalAscent();
Limitations
Currently not supported
- Compressed time stamps
- Components
sportlog/fit 适用场景与选型建议
sportlog/fit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.43k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2021 年 02 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「garmin」 「Fit」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sportlog/fit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sportlog/fit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sportlog/fit 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP library to connect and use garmin wellness api
Symfony 8 bundle for on-demand image processing, resizing, cropping, AVIF/WebP conversion, and caching. Filter pipelines with fit, fill, optimize, strip, interlace processors and avifenc, cwebp, MozJPEG, pngquant post-processors. Filesystem, stream, and S3 loaders/resolvers. HMAC-signed runtime URLs
PHP library for parsing cycling GPS activities and calculating metrics.
A library designed to create, modify, handle, and store images from any protocol
This package is for fitting image
ImgMan connected resource for Apigility
统计信息
- 总下载量: 8.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-06