spatie/workshop-unit-conversions
Lightweight PHP package for performing unit conversions in Laravel or any PHP app. Install via Composer and convert values between supported units with a simple API. Includes tests, changelog, and MIT license.
The spatie/workshop-unit-conversions package provides a lightweight, domain-specific solution for handling unit conversions (e.g., length, weight, temperature) in PHP/Laravel applications. It aligns well with data transformation layers (e.g., API responses, business logic, or validation) where unit normalization is required. The package’s simplicity makes it suitable for:
Key Limitation: The package lacks active maintenance (last release: 2021) and has minimal adoption (0 dependents), which may introduce technical debt if requirements evolve.
use Spatie\WorkshopUnitConversions\UnitConverter;
$converter = new UnitConverter();
$miles = $converter->convert(100, 'miles', 'kilometers'); // Returns ~160.934
league/unit) or build a custom solution?league/unit) or a custom implementation.php artisan vendor:publish.AppServiceProvider or use Laravel’s autowiring.// Before
$weightKg = $weightLbs * 0.453592;
// After
$converter->convert($weightLbs, 'pounds', 'kilograms');
Str::isUpper($unit) for predefined units).1 mile = 1.60934 km).league/unit).How can I help you explore Laravel packages today?