PHP code example of devsquared / unitconvert-laravel
1. Go to this page and download the library: Download devsquared/unitconvert-laravel 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/ */
devsquared / unitconvert-laravel example snippets
// config/app.php
'providers' => [
...
DevSquared\UnitConvert\UnitConvertProvider::class,
...
];
'aliases' => [
...
'UnitConvert' => DevSquared\UnitConvert\UnitConvertFacade::class,
...
];
$response = UnitConvert::convert('20 miles', 'gallons');
if ($response->getSuccess() == false) {
return $response->getError();
}
return $response->getDisplay();