Looking to hire Laravel developers? Try LaraJobs

xecdapi-for-laravel maintained by icekristal

Description
Laravel Xecdapi
Author
Last update
2024/09/05 19:31 (dev-master)
License
Links
Downloads
176

Comments
comments powered by Disqus

xecdapi-for-laravel

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