gecleanme / xkunverio
Unit Conversions made a breeze
2.1.2
2024-04-07 08:12 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
README
Zero-dependency, slim Laravel package to convert between different units with ease
Installation
You can install the package via composer:
composer require gecleanme/xkunverio
Usage
// use the designated Conversion Type Class & its corresponding Enum following the naming pattern : //"X{ConversionType}" & "X{ConversionType}Unit" for the Enum use gecleanme\Xkunverio\Enums\XLengthUnit; use gecleanme\Xkunverio\XLength; // Invoke the 'convert' method with the "unit from", "unit to" and the measurement value then call // get() // Convert one Kilometer to Meters XLength::convert(XLengthUnit::Kilometer, XLengthUnit::Meter, 1) ->get(); //1000.0
Testing
composer test
Supported Length Units
- Meter
- Kilometer
- Mile
- Yard
- Centimeter
- Inch
- Feet
- Millimeter
Supported Area Units
- Square Inches
- Square Feet
- Square Yards
- Square Miles
- Square Millimeter
- Square Centimeter
- Square Meters
- Square Kilometers
Supported Mass Units
- Kilograms
- Ounces
- Pounds
- Stones
- Long Tonnes
- Short Tonnes
- Milligrams
- Grams
- Metric Tonnes
Supported Speed Units
- Meters Per Second
- Kilometers Per Hour
- Miles Per Hour
- Knots
Supported Temperature Units
- Celsius
- Fahrenheit
- Kelvin
Supported Volume Units
- Cubic Inches
- Cubic Feet
- Cubic Centimeters
- Milliliters
- Cubic Meters
- Imperial Gallons
- Imperial Quarts
- Imperial Pints
- Imperial Cups
- Imperial Ounces
- Imperial Tablespoons
- Imperial Teaspoons
- Liters
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Report them by Emailing me
Credits
License
The MIT License (MIT). Please see License File for more information.