PHP code example of estratos / sie-banxico
1. Go to this page and download the library: Download estratos/sie-banxico 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/ */
estratos / sie-banxico example snippets
return [
// ...
Estratos\SieBanxico\SieBanxico::class => ['all' => true],
];
namespace App\Controller;
use Estratos\SieBanxico\SieBanxicoClient;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class BanxicoController
{
public function __construct(private readonly SieBanxicoClient $sie)
{
}
#[Route('/banxico/tipo', name: 'app_banxico_api_tipo')]
public function getBanxicoRate(): Response
{
return $this->json([
'liquidacion' => $this->sie->exchangeRateUsdLiquidation(),
'determinacion' => $this->sie->exchangeRateUsdDetermination(),
'euro' => $this->sie->exchangeRateEuroDetermination(),
]);
}
}
use Estratos\SieBanxico\SieBanxico;
$service = new SieBanxico($token);
$service->ClientInit();
$tipoDeCambio = $service->getExchangeRate();
powershell
$env:SIE_BANXICO_COMPAT_VENDOR = "$PWD\.compat\6.4\vendor"
php vendor/bin/phpunit --bootstrap tests/bootstrap.php tests