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

Distance Laravel Package

frost/distance

PHP distance conversion library for US and metric units. Convert between mi, ft, in, km, m, cm, and mm (US↔metric, US↔US, metric↔metric). Simple fluent API: setUnit(), setDistance(), convertTo().

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables rapid implementation of distance conversion features (e.g., travel apps, logistics tools, fitness trackers, or e-commerce product dimensions).
  • Roadmap Efficiency: Accelerates time-to-market for distance-related functionality, reducing backend development effort.
  • Build vs. Buy: Justifies a "buy" decision over custom development for non-core distance conversion logic, especially if the team lacks specialized math expertise.
  • Use Cases:
    • Travel/Navigation Apps: Convert user-input distances (e.g., "5 km" → "3.1 mi").
    • E-Commerce: Standardize product dimensions (e.g., "12 in" ↔ "30.48 cm").
    • Fitness/Health: Sync metrics between US/metric systems (e.g., running distances).
    • Logistics/Supply Chain: Automate unit conversions for shipping labels or warehouse measurements.
    • Data Migration: Cleanse legacy systems with inconsistent distance units.

When to Consider This Package

  • Adopt if:
    • Your product requires simple, accurate distance conversions between common US/metric units (no complex calculations like geodesic distances).
    • You need a lightweight, dependency-free solution (MIT-licensed, ~300 LOC).
    • Your team lacks time/resources to build or validate conversion logic from scratch.
    • You prioritize maintainability over customization (e.g., no need for custom units like nautical miles or astronomical units).
  • Look elsewhere if:
    • You need geospatial distance calculations (e.g., Haversine formula for lat/long).
    • Your use case involves non-standard units (e.g., furlongs, light-years) or precision beyond 6 decimal places.
    • You require real-time API integrations (e.g., Google Maps distance matrix) instead of local calculations.
    • Your team prefers a batteries-included framework (e.g., Laravel’s built-in helpers or a package with caching/validation).
    • The package’s maturity/activity is a concern (low stars, no dependents, untested in production).

How to Pitch It (Stakeholders)

For Executives: "This MIT-licensed, open-source library lets us add distance conversion features in hours—not weeks—without hiring specialized math talent. For example, we could enable users to toggle between miles and kilometers in our travel app or standardize product dimensions globally. It’s a low-risk, high-reward ‘buy’ that reduces dev overhead and speeds up feature delivery. Given its simplicity, we can validate it quickly in a sandbox before committing to production."

For Engineering: *"The package is a single, dependency-free class with a clean API:

$distance = new \Frost\Distance();
$distance->setUnit('km')->setDistance(10)->convertTo('mi'); // Returns 6.21371
  • Pros:
    • Supports all our target units (mi, ft, in, km, m, cm, mm).
    • No external dependencies; easy to audit/test.
    • MIT license = no legal blockers.
  • Cons:
    • No built-in error handling (e.g., invalid units). We’d need to wrap it in a service layer.
    • Minimal docs, but the code is straightforward.
  • Recommendation: Use it for MVP, then evaluate if we need to extend it (e.g., add validation, caching) or replace it later if requirements grow."*

For Design/Product: *"This solves a common UX pain point—users inputting distances in their preferred unit (e.g., miles in the US, kilometers in Europe). With this, we can:

  • Add a unit dropdown to distance inputs (e.g., ‘5 [km ▼]’).
  • Auto-convert backend data for consistency (e.g., store in meters, display in local units).
  • Avoid manual calculations that risk errors or user confusion. Example: A runner tracking a 10K could see ‘10 km’ or ‘6.2 mi’ based on their locale."*
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings