PHP code example of pointybeard / laravel-unit-converter
1. Go to this page and download the library: Download pointybeard/laravel-unit-converter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pointybeard / laravel-unit-converter example snippets
use pointybeard\LaravelUnitConverter\Facades\UnitConverter;
// 25 Celsius to Fahrenheit
$result = UnitConverter::convert(25)->from('c')->to('f');
echo $result; // 77
// 2.5 Kilograms to Pounds
$result = UnitConverter::convert(2.5)->from('kg')->to('lb');
echo $result; // 5.51156
// 1,000 Millimeters to Meters
$result = UnitConverter::convert(1000)->from('mm')->to('m');
echo $result; // 1