finller/laravel-forex

Forex for Laravel

Fund package maintenance!
Finller

v1.1.2 2024-03-19 15:23 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Easily retreive latest exchange rates value in your app.

By default, this package use the free endpoint provided by exchangerate-api.com but you can use it with any forex provider.

Installation

You can install the package via composer:

composer require finller/laravel-forex

You can publish the config file with:

php artisan vendor:publish --tag="laravel-forex-config"

This is the contents of the published config file:

use Finller\Forex\Integrations\ExchangeRateApi\ExchangeRateApiConnector;

return [

    'cache' => [
        'enabled' => true,
        'driver' => env('FOREX_CACHE_DRIVER', env('CACHE_DRIVER', 'file')),
        'expiry_seconds' => 86_400,
    ],

    'rate_limit' => [
        'enabled' => false,
        'driver' => env('FOREX_RATE_LIMIT_DRIVER', env('CACHE_DRIVER', 'file')),
        'every_seconds' => 3_600,
    ],

    'client' => ExchangeRateApiConnector::class,

];

Usage

$rates = \Finller\Forex\Facades\Forex::get('USD');

$USD_to_EUR_rate = $rates['EUR'];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.