2017 © Pedro Peláez
 

library bmr

PHP class to calculate the "Basal Metabolic Rate" using the The Mifflin St Jeor Equation. Supports lb, kg and stone for weight, and feet, inches and cm for height.

image

footballencarta/bmr

PHP class to calculate the "Basal Metabolic Rate" using the The Mifflin St Jeor Equation. Supports lb, kg and stone for weight, and feet, inches and cm for height.

  • Monday, April 24, 2017
  • by footballencarta
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 13 % Grown

The README.md

Build Status, (*1)

BMR

PHP class to calculate the "Basal Metabolic Rate" using the The Mifflin St Jeor Equation. Supports lb, kg and stone for weight, and feet, inches and cm for height., (*2)

Installation:

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:, (*3)

composer require footballencarta/bmr

Usage

The class is designed to work in a fluent way, so each option needs to be set before calculation, (*4)

Get the BMR

echo (new Footballencarta\BMR())
    ->age(55)
    ->gender(BMR::FEMALE)
    ->heightInFeet(5, 6)
    ->weightInStone(9, 4)
    ->calculate();

// Result: 1204

Functions

Height

For cm (centimeters), use the function ->heightInMetres($metres, $centimetres). This does allow metres to be 0 to allow just centimetres to be passed through, (*5)

For feet & inches, use the function ->heightInFeet($feet, $inches). Feet must be between 3 and 9, and inches must be between 0 and 11., (*6)

Weight

For kg (kilograms), use the function ->weightInKg($kg)., (*7)

For lb (pounds), use the function ->weightInLb($lb)., (*8)

For stone & pounds , use the function ->weightInStone($stone, $lb). This does allow stone to be 0 to allow just pounds to be passed through, (*9)

Gender

Unfortunately, the BMR calculation requires a binary gender., (*10)

For compatibility, it's suggested to use the BMR::MALE or BMR::FEMALE constants., (*11)

If you don't want to use the constants, any word beginning with an m is flagged as male, and anything with an f is flagged as female., (*12)

->gender(BMR::FEMALE) or ->gender('female'), (*13)

Age

The age must be greater than 18 for the BMR calculation to work., (*14)

->age(55);, (*15)

Calculate function

You can use ->calculate() to perform the calculation, which will return your BMR value., (*16)

You could also use ->getFormattedBmr() to provide a 2dp number formatted version., (*17)

If there are any validation problems, either a OutOfRangeException or InvalidArgumentException will be thrown, (*18)

The Versions

24/04 2017

dev-master

9999999-dev

PHP class to calculate the "Basal Metabolic Rate" using the The Mifflin St Jeor Equation. Supports lb, kg and stone for weight, and feet, inches and cm for height.

  Sources   Download

MIT

The Development Requires

by Damon Williams

bmr