PHP code example of gocanto / converter

1. Go to this page and download the library: Download gocanto/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/ */

    

gocanto / converter example snippets


use Gocanto\Converter\Examples\CurrenciesRepositoryExample;
use Gocanto\Converter\Converter;

$repository = new CurrenciesRepositoryExample;
$converter = new Converter($repository);

use Gocanto\Converter\RoundedNumber;

$conversion = $converter
    ->withAmount(RoundedNumber::make(10))
    ->withCurrency('SGD')
    ->convertTo('USD');