nkootstra/unit-conversion

This package is abandoned and no longer maintained. No replacement package was suggested.

Unit conversion

v1.0.1 2020-06-06 13:25 UTC

This package is auto-updated.

Last update: 2020-08-06 13:50:31 UTC


README

Github Actions CI Latest Version on Packagist Total Downloads

This package is made with the intention to make it easier to convert units. It's also possible to let the package figure out what kind unit has been used.

Installation

You can install the package via composer:

composer require nkootstra/unit-conversion

Usage

$guess = new UnitGuesser;
$unit = $guess->guess('2,5 x 5 l');
$unit->getQuantity(); // 12.5
$unit->getUnit(); // liter
$guess = new UnitGuesser;
$unit = $guess->guess('1,5 l');

$conversion = new UnitConversion;
$converted = $conversion->convert($unit, 'milliliter');
$converted->getQuantity(); // 15000
$converted->getUnit(); // milliliter

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email niels.kootstra@gmail.com instead of using the issue tracker.

Credits

License

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