icekristal / xecdapi-for-laravel
Laravel Xecdapi
v0.0.6
2024-09-05 17:31 UTC
Requires
- php: ^8.1
- laravel/framework: ^9|^10|^11
README
Documentation: https://xecdapi.xe.com/docs/v1
install:
composer require icekristal/xecdapi-for-laravel
add config services.php:
'xecdapi' => [ 'auth' => [ 'username' => env('XECD_USERNAME'), 'password' => env('XECD_PASSWORD'), ], 'base_url' => env('XECD_URL', 'https://xecdapi.xe.com'), ],
config:
php artisan vendor:publish --provider="Icekristal\XecdapiForLaravel\XecdapiServiceProvider" --tag="config"
use:
use Icekristal\XecdapiForLaravel\Facades; Xecdapi::getAccountInfo(); $needParams = [ 'from' => 'USD', //example 'to' => 'EUR', //example 'amount' => 1, //example ]; Xecdapi::setQueryParams($needParams)->getCurrencies(); Xecdapi::setQueryParams($needParams)->convertFrom(); Xecdapi::setQueryParams($needParams)->convertTo(); Xecdapi::setQueryParams($needParams)->centralBankExchangeRate(); //custom convert one to one Xecdapi::fastConvertFiat(string $from, string $to, float|int $amount = 1); //return float; if -1 then error