Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Unit Laravel Package

jobmetric/laravel-unit

Laravel Unit is a package for working with measurement units in your Laravel app. It helps you define, manage, and convert units with a clean, extendable structure. Lightweight and easy to integrate, useful for storing and displaying quantities consistently.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature scoping for measurement-driven work. Anything that stores or displays a physical quantity — product weight/dimensions for shipping, package sizes, ingredient quantities, fuel/energy consumption, dosage or serving sizes, fabric lengths, temperature — needs one canonical place to define units, convert, and format. This package is a candidate to be that place, so it directly informs scope on shipping-cost estimation, unit-aware catalogs, and serving/portion calculators.
  • Build vs. buy for conversion logic. The honest framing: the code is cheap (a lookup table plus multipliers is a day or two), but the edge cases are not — rounding policy, precision loss from floats, display formatting, rounding direction on money-adjacent quantities, and unit naming/localization. This package is worth buying only if it absorbs those edge cases. If it does not, it is a thin wrapper and the build option wins.
  • Market/region rollout sequencing. Metric-vs-imperial is a market-entry constraint, not a UI toggle. Adopting a unit layer early makes "launch in a market that expects imperial" a config change instead of a schema migration; deferring it makes it a data-migration project. This is a roadmap-sequencing decision the package either unlocks or blocks.
  • Data model decision: canonical storage vs. display conversion. The package's existence nudges toward storing values in a canonical base unit and converting only at the presentation and input boundaries. That is the right call for reporting, comparison, sorting, and aggregation, and it is a decision that must be made before the first quantity column ships — retrofitting it is expensive.
  • Internationalization of measurement display. Localized number formatting, decimal separators, and unit labels ("1,5 kg" vs "1.5 kg" vs "3 lb 5 oz") are a product-quality requirement in non-US markets. If the package covers formatting, it collapses a chunk of i18n work; if it only converts, the formatting work remains yours.
  • Use cases worth prototyping with it: unit-aware shipping quotes, recipe/portion scaling, fitness and health tracking input, product dimension entry in an admin panel, energy/fuel consumption display, and any "enter in your preferred unit, we store the base unit" form.
  • Diligence caveat for the decision log: the supplied evaluation notes describe a translation-loader package, not a units package. Before any of the above is treated as validated, the team must re-read this package's own composer.json, config, and service provider. That mismatch alone is a signal that internal evaluation artifacts need verification before they inform a roadmap commitment.

When to Consider This Package

Consider it when:

  • The application is already on Laravel and you want unit definitions and conversions registered through the framework's config/service-provider conventions rather than a standalone library glued in by hand.
  • Your unit requirements are conventional and finite: length, mass, volume, temperature, time, and a handful of domain-specific units. You need conversions and display formatting, not dimensional analysis.
  • You want units to be configurable per project — custom units (a "pallet", a "case", a "serving") and custom conversion factors — without editing vendor code.
  • The team is small and would rather own a config file than maintain conversion math, and the tolerance for a low-maturity dependency is genuine.
  • You are prototyping or building an internal tool where a missing conversion is an inconvenience rather than a compliance event.

Look elsewhere when:

  • Precision is regulated or money-adjacent. Pharmaceutical dosing, financial settlement, lab work, or anything with an audit trail needs a decimal-arithmetic foundation (e.g. brick/math) and provable rounding rules. Six GitHub stars and a 2024 release date are not a sufficient assurance story for that class of risk.
  • You need real dimensional analysis — compound or derived units (kg·m/s², kWh per unit mass), unit algebra, or automatic simplification. Packages in this weight class typically do flat factor conversion between a declared base and its siblings, which will not model derived units.
  • The package turns out to be a thin wrapper over a more established units library. In that case depend on the underlying library directly and remove a layer from your supply chain.
  • You need runtime-editable units. If product managers must add units or change conversion factors from an admin screen without a deploy, verify first whether definitions live in config (deploy-bound) or in the database. Config-only is the common shape and it is a real constraint, not a detail.
  • Your stack is not Laravel, or you are on a Laravel version outside the package's tested range. With six stars, assume no CI matrix and no LTS policy; treat framework compatibility as unverified until you have read composer.json.
  • Support and longevity matter. Single-maintainer, low-visibility projects carry abandonment risk. If the unit layer will sit under pricing, shipping, or inventory for years, the maintenance model is part of the buy decision. Ask: is there an issue tracker with triage, a security disclosure path, and a release cadence?
  • Licensing or provenance diligence is required. MIT is permissive and fine, but confirm the vendor's other packages and the dependency graph are equally clean before this enters a regulated or enterprise codebase.

How to Pitch It (Stakeholders)

For executives (one paragraph). We have a recurring category of feature work — shipping estimates, unit-aware catalogs, portion and dosage calculators, market-specific measurement display — where every team re-implements the same conversion and formatting logic and every re-implementation gets rounding subtly wrong. This package is a small, MIT-licensed, Laravel-native component that would centralize unit definitions, conversions, and display formatting behind one configurable interface, letting us store quantities once in a canonical unit and present them in whatever unit a market expects. The upside is speed and consistency: launching in an imperial-market country becomes a configuration change rather than a data migration. The caveat is maturity — it is a low-adoption, single-maintainer project last released in August 2024 — so the recommendation is a time-boxed spike on a non-critical feature, not a platform-wide commitment, with a fallback of building the same thin layer in-house if the spike exposes gaps in precision handling, runtime configurability, or derived units.

For engineering (the ask). Evaluate, don't adopt. Specifically: (1) read composer.json and the service provider to confirm supported Laravel/PHP ranges and whether this is a wrapper around another library — if it is, we should depend on that library directly; (2) determine whether unit definitions and conversion factors live in config (deploy-bound) or in the database (runtime-editable), because that decides whether product can self-serve; (3) test precision behavior on repeated conversions and confirm rounding is explicit and configurable rather than emergent from floats; (4) confirm the formatting story covers locale-aware number rendering, not just unit labels; (5) check whether compound/derived units are representable, since our shipping work will eventually need volumetric weight. If those five come back clean, spike it behind an interface we own — a UnitConverter contract with two implementations — so replacing it later is a one-line container binding rather than a refactor. If they come back ambiguous, build the same contract in-house; the math is not the hard part, the rounding policy and the storage convention are, and we own those either way.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel