1. Go to this page and download the library: Download cotizave/sdk 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/ */
cotizave / sdk example snippets
use Cotizave\Cotizave;
// Reads COTIZAVE_API_KEY from the environment; or pass ['apiKey' => '...'].
$client = new Cotizave();
// Every rate published for a country.
$response = $client->rates->list('AR');
foreach ($response['rates'] as $rate) {
echo $rate['id'], ' ', $rate['mid'] ?? '', PHP_EOL;
}
// A single rate by its canonical id.
$trm = $client->rates->get('CO', 'co-trm');
echo $trm['mid'];
// A currency conversion (resolved on Cotizave, never computed client-side).
$result = $client->convert(['from' => 'USD', 'to' => 'BRL', 'amount' => 100]);
echo $result['to']['amount'];
$client = new Cotizave(['apiKey' => 'ctz_live_...']); // explicit
$client = new Cotizave(); // from COTIZAVE_API_KEY
use Cotizave\Cotizave;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
$mock = new MockHandler([new Response(200, [], '{"id":"co-trm"}')]);
$client = new Cotizave(['handler' => $mock]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.