Package Data | |
---|---|
Maintainer Username: | abhimanyu003 |
Maintainer Contact: | abhimanyusharma003@gmail.com (Abhimanyu Sharma) |
Package Create Date: | 2014-06-04 |
Package Last Update: | 2022-07-12 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-21 03:15:01 |
Package Statistics | |
---|---|
Total Downloads: | 60,036 |
Monthly Downloads: | 36 |
Daily Downloads: | 0 |
Total Stars: | 52 |
Total Watchers: | 6 |
Total Forks: | 18 |
Total Open Issues: | 5 |
Library help to convert units.
composer.json
// ...
"abhimanyusharma003/conversion": "dev-master"
// ...
Run composer update
or composer install
Open config/app.php
and add the service provider to your providers
array.
Abhimanyu003\Conversion\ConversionServiceProvider::class
'Conversion' => Abhimanyu003\Conversion\Facades\Conversion::class
Conversion::convert($value,'type')->to('type');
Formatting results use
Conversion::convert($value,'type')->to('type')
->format(int decimal,'decimal place modifier','thousand place modifer');
Conversion::convert(1, 'megabyte')->to('kilobyte'); // output 1,024.00 ( two decimal place )
// Formatting the output
Conversion::convert(1, 'megabyte')->to('kilobyte')->format(0,'.',','); // output 1,024 ( no decimal place )
Conversion::convert(1000,'millimetre')->to('centimetre');
Conversion::convert(1,'kilogram')->to('gram');
METRE_PER_SECOND_SQUARE
TURN
RADIAN
DEGREE
GRADIAN
SQUARE_METRE
HECTARE
SQUARE_KILOMETRE
SQUARE_INCH
SQUARE_FEET
SQUARE_YARD
ACRE
SQUARE_MILE
BIT
BYTE
KILOBIT
KILOBYTE
MEGABIT
MEGABYTE
GIGABIT
GIGABYTE
TERABIT
TERABYTE
PETABIT
PETABYTE
STATAMPERE
MICROAMPERE
MILLIAMPERE
AMPERE
ABAMPERE
KILOAMPERE
KILOMETRES_PER_LITRE
LITRE_PER_100_KILOMETRE
MILES_PER_GALLON
US_MILES_PER_GALLON
MILLIMETRE
CENTIMETRE
METRE
KILOMETRE
INCH
FOOT
YARD
MILE
NAUTICAL_MILE
MICROGRAM
MILLIGRAM
GRAM
KILOGRAM
METRIC_TON
OUNCE
POUND
STONE
SHORT_TON
LONG_TON
PASCAL
KILOPASCAL
MEGAPASCAL
BAR
MILLIMETRES_OF_MERCURY
INCHES_OF_MERCURY
POUNDS_PER_SQUARE_INCH
ATMOSPHERE
METRE_PER_SECOND
KILOMETRES_PER_HOUR
FEET_PER_SECOND
MILES_PER_HOUR
KNOT
CELSIUS
FAHRENHEIT
KELVIN
NANOSECOND
MICROSECOND
MILLISECOND
SECOND
MINUTE
HOUR
DAY
WEEK
MONTH
YEAR
DECADE
CENTURY
MILLENIUM
VOLT
KILOVOLT
MILLILITRE
LITRE
CUBIC_METRE
GALLON
QUART
PINT
TABLESPOON
TEASPOON
US_GALLON
US_QUART
US_PINT
US_CUP
US_OUNCE
US_TABLESPOON
US_TEASPOON
CUBIC_INCH
CUBIC_FOOT
Feel free to contribute and update the rep.