centrex / laravel-open-exchange-rates
This is my package laravel-open-exchange-rates
Package info
github.com/centrex/laravel-open-exchange-rates
pkg:composer/centrex/laravel-open-exchange-rates
v1.2.0
2025-02-05 06:19 UTC
Requires
- php: ^8.2|^8.3|^8.4
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.5
- orchestra/testbench: ^9.5
- pestphp/pest: ^3.4
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- rector/rector: ^1.2
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2026-04-11 08:03:56 UTC
README
Laravel client for the Open Exchange Rates API. Provides access to latest rates, historical rates, currency conversion, OHLC data, time-series, and account usage.
Installation
composer require centrex/laravel-open-exchange-rates
php artisan vendor:publish --tag="laravel-open-exchange-rates-config"
Add your App ID to .env:
OPEN_EXCHANGE_RATES_APP_ID=your_app_id_here
Usage
use Centrex\LaravelOpenExchangeRates\Facades\OpenExchangeRates; // Latest rates (all currencies) $rates = OpenExchangeRates::latest(); // Latest rates for specific currencies $rates = OpenExchangeRates::latest('USD,EUR,BDT,GBP'); // Historical rates for a date $rates = OpenExchangeRates::historical('2024-01-01'); $rates = OpenExchangeRates::historical('2024-01-01', 'USD,EUR'); // Convert a value between currencies $result = OpenExchangeRates::convert(100, 'USD', 'BDT'); // Full list of available currencies $currencies = OpenExchangeRates::currencies(); $currencies = OpenExchangeRates::currencies(showAlternative: '1'); // Time-series rates between two dates $series = OpenExchangeRates::timeSeries('2024-01-01', '2024-01-31', 'USD,EUR'); // OHLC (Open, High, Low, Close) for a period // Allowed periods: 1m, 5m, 15m, 30m, 1h, 12h, 1d, 1w, 1mo $ohlc = OpenExchangeRates::ohlc('2024-01-01T00:00:00Z', '1d', 'USD,EUR'); // Account usage stats $usage = OpenExchangeRates::usage();
All methods return a decoded array. An OpenExchangeRatesResponseException is thrown on API errors.
Testing
composer test # full suite composer test:unit # pest only composer test:types # phpstan composer lint # pint
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.