PHP code example of apiotrowski / unit-converter
1. Go to this page and download the library: Download apiotrowski/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/ */
apiotrowski / unit-converter example snippets
(new LengthConverter())->convertTo(new Value(10, UnitFactory::build(LengthUnit::CENTIMETRE)), UnitFactory::build(LengthUnit::INCH));
$convertManager = new ConvertManager(new ArrayCollection([ new LengthConverter(), new WeightConverter() ]), new QueryResolver());
$convertedValue = $convertManager->convert('10cm to ?in');