Weave Code
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

Weight Conversions Laravel Package

spatie/weight-conversions

Lightweight PHP package for converting between common weight units (e.g., grams, kilograms, pounds, ounces). Handy for apps needing consistent unit handling in calculations, forms, and APIs, with a simple, dependency-free API.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables seamless integration of weight unit conversions (e.g., kg ↔ lbs, metric ↔ imperial) into applications requiring multi-unit support (e.g., e-commerce, logistics, fitness apps).
  • Roadmap Alignment: Accelerates development for globalized products needing localized weight measurements (e.g., expanding to markets with imperial/metric preferences).
  • Build vs. Buy: Buy—avoids reinventing conversion logic, reducing dev time and maintenance overhead. Ideal for small-to-medium teams lacking specialized math libraries.
  • Use Cases:
    • E-commerce: Display product weights in user-preferred units (e.g., "1.5 kg" or "3.3 lbs").
    • Health/Fitness: Convert user inputs (e.g., "I weigh 150 lbs" → "68 kg").
    • Logistics: Standardize shipment weights across international systems.
    • Data Migration: Cleanse legacy data with inconsistent weight units.

When to Consider This Package

  • Adopt if:

    • Your app requires simple, accurate weight conversions (no complex calculations like volume/density).
    • You’re using Laravel/PHP and want a lightweight, MIT-licensed solution.
    • Your team lacks time/resources to build or validate conversion logic.
    • You need localization support (e.g., auto-detect user’s preferred unit system).
  • Look elsewhere if:

    • You need advanced unit systems (e.g., troy ounces, carats) or custom conversions (e.g., weight-to-volume).
    • Your app demands high-performance batch processing (this is a thin wrapper; optimize for bulk use cases).
    • You require active maintenance (last release: 2021; verify if updates are critical).
    • You’re using a non-PHP stack (e.g., Node.js, Python).

How to Pitch It (Stakeholders)

For Executives: "This package lets us add weight conversions in hours—not weeks—by leveraging Spatie’s battle-tested PHP library. For example, a global e-commerce site can instantly display product weights in kg or lbs based on user location, improving UX and reducing support costs. It’s a low-risk, high-reward ‘buy’ that eliminates dev overhead and ensures accuracy. MIT license means no vendor lock-in."

For Engineering: *"Spatie’s weight-conversions is a 5-minute install (composer require spatie/weight-conversions) with zero dependencies. It handles all standard units (grams, kg, lbs, oz, stones) via a clean API:

use Spatie\WeightConversions\Facades\WeightConversions;
$kg = WeightConversions::convert(150, 'lbs', 'kg'); // Returns 68.0388555
  • Pros: Lightweight, tested, and Laravel-friendly. Works with facades or direct usage.
  • Cons: Last updated in 2021 (check if your needs are covered). No active maintenance, but MIT license allows forks if needed. Recommendation: Use for MVP/localization features; pair with unit tests to validate edge cases."*
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport