PHP code example of andresaya / trmco
1. Go to this page and download the library: Download andresaya/trmco 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/ */
andresaya / trmco example snippets
AndresAya\TrmCo\TrmCo;
$trmco = new TrmCo();
// get current TRM
$response = $trmco->query()->get();
// get a date based TRM
$response = $trmco->query('2023-01-01')->get();
// get current and convert to USD
$response = $trmco->query()->copToUsd(15000);
// get current and convert to COP
$response = $trmco->query()->usdToCop(3);
// get a date based TRM and convert to USD
$response = $trmco->query('2023-01-01')->copToUsd(15000);
// get a date based TRM and convert to COP
$response = $trmco->query('2023-01-01')->usdToCop(3);
print_r($response);
stdClass Object
(
[id] => 1530351
[unit] => COP
[validityFrom] => 2023-07-22T00:00:00-05:00
[validityTo] => 2023-07-24T00:00:00-05:00
[value] => 3971.38
[success] => 1
)