jordanbrauer/unit-converter
A PHP library for converting between units of measurement—length, mass, volume, temperature, speed, area and more—with a clean fluent API, automatic unit resolution, and support for registering custom units. Framework-agnostic with no dependencies.
Adopt when most of these hold:
UnitConverter facade means low onboarding cost for a Laravel team; conversion reads as a one-liner rather than a bespoke utility class.Look elsewhere — or just write ~50 lines yourself — when:
To executives: This is a small, cheap dependency that lets us ship unit-aware features — metric/imperial toggles, mixed-unit imports, consistent reporting — without spending engineering time building a conversion table from scratch. It removes a recurring blocker from our internationalization and physical-goods roadmap at roughly the cost of a code review. The honest caveat: it's a low-adoption, single-maintainer open-source library, so we should treat it as a replaceable component rather than a foundation — wrap it behind our own interface so we can swap or replace it in a day if it goes stale. Net recommendation: adopt narrowly, budget half a day of engineering to insulate it, revisit if usage spreads beyond a handful of call sites.
To engineering: Laravel-native — service provider and facade, so it fits our conventions and reads well (convert($value)->from(...)->to(...)). It covers the standard measurement families and lets us register domain-specific units instead of forking. Two asks: (1) put it behind our own UnitConverter-style contract so no business logic imports the vendor namespace directly, and (2) pin the version and add coverage tests against a fixture table of known-good conversions, because we can't count on upstream to catch regressions for us. If either ask is rejected, build the thin internal utility instead — the functionality is not deep.
How can I help you explore Laravel packages today?