PHP code example of kosmosafive / kosmosafive.cbrrates
1. Go to this page and download the library: Download kosmosafive/kosmosafive.cbrrates 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/ */
kosmosafive / kosmosafive.cbrrates example snippets
use Bitrix\Main\Loader;
use Bitrix\Main\DI\ServiceLocator;
use Kosmosafive\CBRRates\CBRApiInterface;
$api = ServiceLocator::getInstance()->get(CBRApiInterface::class);
$client = $api->getClient();
$rateCollection = (new Route\Scripts\XmlDaily($client))->get();
use Bitrix\Main\Loader;
use Bitrix\Main\DI\ServiceLocator;
use Kosmosafive\CBRRates\Service\ApiServiceInterface;
$apiService = ServiceLocator::getInstance()->get(ApiServiceInterface::class);
$rateCollection = $apiService->getDailyRates();
use Kosmosafive\CBRRates\Options;
$clientKey = 'custom';
$options = new Options();
$client = new Client($options);
$addClientResult = $apiService->addClient($clientKey, $client);
$client = $apiService->getClient($clientKey);
namespace Kosmosafive\CBRRates\Diag\Logger;
use Kosmosafive\CBRRates\Http\RequestInterface;
use Kosmosafive\CBRRates\Http\ResponseInterface;
interface HttpLoggerInterface
{
public function logRequest(string $level, RequestInterface $request): void;
public function logResponse(string $level, ResponseInterface $response): void;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.