cesargb / metric-conversion
Calculators for metric conversions
v0.1-beta
2019-04-09 20:57 UTC
Requires
- php: ^7.3
- eloquent/enumeration: ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-07 11:54:08 UTC
README
Metric Conversion
Library to metric conversions.
Install
Via Composer
$ composer require cesargb/metric-conversion
Usage
use Cesargb\Metric\Time; use Cesargb\Metric\Speed; use Cesargb\Metric\Length; // ... $yards = Length::convertMeters(10) ->toYards(); // $yards = 10.94 $yards = Length::convertMeters(10) ->setPrecision(4) ->toYards(); // $yards = 10.9361 $kilograms = Weight::convertGrams(2305) ->toKilograms(); // $kilograms = 2.31 $kilograms = Weight::convertGrams(2305) ->setPrecision(4) ->toKilograms(); // $kilograms = 2.305 $kilograms = Weight::convertGrams(2309) ->setRound(PHP_ROUND_HALF_EVEN) ->toKilograms(); // $kilograms = 2.30 $yardsMinutes = Speed::convertKilometersHours(100) ->toYardsMinutes(); // $yardsMinutes = 1822.69 $pacePerKilometer = Speed::converKilometersHours(15) ->toMinutesKilomenters(); // $pacePerKilometer = 4
Testing
$ composer test
TODO
- Add documentation
- More metrics