PHP code example of peso / coinlayer-service

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

    

peso / coinlayer-service example snippets




use Peso\Peso\CurrencyConverter;
use Peso\Services\Coinlayer\AccessKeyType;
use Peso\Services\CoinlayerService;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;

rvice::reversible('...', AccessKeyType::Free, cache: $cache);
$converter = new CurrencyConverter($service);

// 6.91 as of 2026-04-06
echo $converter->convert('12500', 'USD', 'ETH', 2), PHP_EOL;
bash
composer install peso/coinlayer-service php-http/discovery guzzlehttp/guzzle symfony/cache