isfonzar/tdee-calculator

每日总能量消耗 (TDEE) 计算器

v1.2 2020-10-08 12:30 UTC

This package is auto-updated.

Last update: 2024-09-29 04:53:04 UTC


README

Language License Latest Stable Version

关于 TDEE 计算器

TDEE 计算器是一个 Composer 库,根据体重、身高、年龄或瘦体重来计算每天消耗的能量(卡路里)。

特点

  • 4 种可选的计算公式
  • 可以输入体重、身高和年龄 瘦体重
  • 可配置的输入,支持公制或英制系统。
  • 易于集成到您的项目中
  • 极其 易于使用

安装

Composer

$ composer require isfonzar/tdee-calculator

用法

基本用法

<?php

require(__DIR__ . '/vendor/autoload.php');

// Calculations based on weight, height and age
use isfonzar\TDEECalculator\TDEECalculator;

$tdeeCalculator = new TDEECalculator();

echo $tdeeCalculator->calculate('male', 80, 182, 24);
echo "\n";

// ---------------------------------------------------------
// The unit is parametrizable
$options = [
    'formula' => 'revised_harris_benedict' // You can select the best formula for your needs
    'unit' => 'imperial', // Choose the desired measurement unit
];

$tdeeCalculator = new TDEECalculator($options);

echo $tdeeCalculator->calculate('male', 176, 6, 24);
echo "\n";

// Input activity level
echo $tdeeCalculator->calculate('male', 176, 6, 24, 'very_active');
echo "\n";

 // Calculations based on lean body mass
use isfonzar\TDEECalculator\LBMCalculator;

$options = [
    'unit' => 'metric',
];

$lbmCalculator = new LBMCalculator($options);
echo $lbmCalculator->calculate(80);
echo "\n";

公式

基于体重、身高和年龄

  • 原始 Harris Benedict ('formula' => 'original_harris_benedict')
  • 修订 Harris Benedict ('formula' => 'revised_harris_benedict')
  • Mifflin St Jeor ('formula' => 'mifflin_st_jeor')

基于瘦体重 (LBM)

  • Kath McArdle ('formula' => 'kath_mcardle')

单位

  • 公制 ('unit' => 'metric')
  • 英制 ('unit' => 'imperial')

贡献

错误报告 & 功能请求

请使用 问题跟踪器 报告任何错误或功能请求。

社交编码

  1. 创建一个问题来讨论您的想法
  2. [分支它] (https://github.com/isfonzar/tdee-calculator/fork)
  3. 创建您的功能分支 (git checkout -b my-new-feature)
  4. 提交您的更改 (git commit -am 'Add some feature')
  5. 推送到分支 (git push origin my-new-feature)
  6. 创建新的 Pull Request
  7. 成功!✅