asika/better-units
Better Units is a PHP library for working with units of measure. Convert values between compatible units, define custom units, and format quantities consistently in any PHP or Laravel project.
Consider it when:
UnitConverter interface bound in a Laravel service provider you write yourself — this package ships no Laravel integration).Look elsewhere when:
To executives: This is a small, free (MIT) library for converting units of measurement. The business case isn't the library — it's the class of bugs it prevents: wrong shipping weights, mis-rendered international listings, and pricing shown per-ounce when the customer expects per-100g. Those are refunds, support tickets, and blocked market expansion. Cost is near zero and the risk is contained because we'd hide it behind our own interface and can swap it out. Recommendation: a 1–2 day spike on a single low-risk surface, then a go/no-go.
To engineering: Framework-agnostic PHP converter — no service provider, no Laravel coupling, so we bind it ourselves and keep domain code free of vendor types. Treat it as an implementation detail of our own UnitConverter contract; store canonical base units, convert at the boundary. Given its early stage (minimal adoption), plan to vendor or fork and own the test suite. If the spike shows gaps in unit coverage or precision handling, we fall back to a more established library or a small in-house table — the interface makes that a swap, not a rewrite.
How can I help you explore Laravel packages today?