lum/lum-units

v2.0.0 2021-12-15 23:23 UTC

This package is auto-updated.

Last update: 2024-12-16 06:34:50 UTC


README

Summary

Classes representing different units of measurement, with the ability to convert between them.

The configuration file format is a bit weird, but it's that way for historical reasons. I'll probably make it support a nicer format at some point, while keeping a compatibility wrapper for the original version.

Classes

Examples

See examples for a sample data file, and a script to convert between the units defined in it. You can only convert between units of the same type class. So for instance:

php example/convert.php 10 ha ac
# 24.710516301528

php example/convert.php 5 min sec
# 300

php example/convert.php 1.5 b mb
# 1572864

php example/convert.php 10 ha mb
# PHP Fatal error: Uncaught Lum\Units\Exception...

TODO

  • Write tests.
  • Add new configuration format that is somewhat nicer.
  • Add some kind of formatting feature using the 'sign'.

Official URLs

This library can be found in two places:

Author

Timothy Totten

License

MIT