2017 © Pedro Peláez
 

library fda-nutrition-rounding-php

Library for rounding nutrition values according to FDA guidelines.

image

montopolis/fda-nutrition-rounding-php

Library for rounding nutrition values according to FDA guidelines.

  • Wednesday, May 24, 2017
  • by coreymcmahon
  • Repository
  • 2 Watchers
  • 1 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 31 % Grown

The README.md

FDA Nutrition Rounding in PHP

Basic library for rounding nutritional information according to FDA guidelines (source), (*1)

Install

You can add the library to your existing project using Composer:, (*2)

composer require montopolis/fda-nutrition-rounding-php

Usage

<?php

$rounder = new Montopolis\Fda\Rounding();

$rounder->calorie(123)->toInt(); // outputs 120
$rounder->calorie(123)->toFloat(); // outputs 120.0
$rounder->calorie(123)->toString(); // outputs "120 g"

$rounder->carbohydrate(0.51)->toString(); // outputs "less than 1 g"

Supported nutrient types

At the time of writing, the library supports all nutrient types defined by the FDA guidelines., (*3)

php $rounder->alcohol($value)->toInt(); $rounder->betaCarotene($value)->toInt(); $rounder->calorie($value)->toInt(); $rounder->carbohydrate($value)->toInt(); $rounder->cholesterol($value)->toInt(); $rounder->dietaryFiber($value)->toInt(); $rounder->fat($value)->toInt(); $rounder->mineral($value)->toInt(); $rounder->otherFiber($value)->toInt(); $rounder->potassium($value)->toInt(); $rounder->protein($value)->toInt(); $rounder->sodium($value)->toInt(); $rounder->sugar($value)->toInt(); $rounder->vitamin($value)->toInt();, (*4)

Run the tests

./vendor/bin/phpunit
PHPUnit 4.8.35 by Sebastian Bergmann and contributors.

.........

Time: 100 ms, Memory: 4.00MB

OK (9 tests, 46 assertions)

License

The MIT License (MIT). Please see License File for more information., (*5)

The Versions

24/05 2017

dev-master

9999999-dev

Library for rounding nutrition values according to FDA guidelines.

  Sources   Download

proprietary

The Development Requires

by Corey Mcmahon
by Babul Mukherjee

24/05 2017

v1.0.3

1.0.3.0

Library for rounding nutrition values according to FDA guidelines.

  Sources   Download

proprietary

The Development Requires

by Corey Mcmahon
by Babul Mukherjee

23/05 2017

v1.0.2

1.0.2.0

Library for rounding nutrition values according to FDA guidelines.

  Sources   Download

proprietary

The Development Requires

by Corey Mcmahon
by Babul Mukherjee

22/05 2017

v1.0.1

1.0.1.0

Library for rounding nutrition values according to FDA guidelines.

  Sources   Download

proprietary

The Development Requires

by Corey Mcmahon
by Babul Mukherjee

18/05 2017

v1.0.0

1.0.0.0

Library for rounding nutrition values according to FDA guidelines.

  Sources   Download

proprietary

The Development Requires

by Corey Mcmahon
by Babul Mukherjee