https://github.com/investbrainapp/frankfurter-client
A very lightweight Frankfurter currency exchange API client for Laravel
https://github.com/investbrainapp/frankfurter-client
currency-converter exchange-api forex laravel
Last synced: 2 months ago
JSON representation
A very lightweight Frankfurter currency exchange API client for Laravel
- Host: GitHub
- URL: https://github.com/investbrainapp/frankfurter-client
- Owner: investbrainapp
- License: mit
- Created: 2025-02-06T02:08:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-29T02:39:41.000Z (10 months ago)
- Last Synced: 2025-08-29T06:46:24.907Z (10 months ago)
- Topics: currency-converter, exchange-api, forex, laravel
- Language: PHP
- Homepage: https://frankfurter.dev
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Frankfurter API wrapper for Laravel
This is a simple wrapper for the fantastic Frankfurter API.
### Installation
Use composer to install:
```bash
composer require investbrainapp/frankfurter-client
```
### Usage
This package provides a simple Laravel facade that exposes all functionality provided by the Frankfurter API.
##### Latest
To get the latest exchange rate use the `latest` method:
```php
return Frankfurter::latest();
```
##### Historical
To get a historic exchange rate, pass a well formated date string or a `DateTime` object to the `historical` method:
```php
return Frankfurter::historical('2025-01-01');
```
##### Time series
To get time series data for a range of dates, pass well formated date strings or `DateTime` objects to the `timeSeries` method:
```php
return Frankfurter::timeSeries('2023-01-01', '2024-12-31');
```
If you want all rates between a date in the past and today's date, you can omit the second argument to the `timeSeries` method:
```php
return Frankfurter::timeSeries('2023-01-01');
```
##### Supported currencies
You can call the `currencies` method to get a list of all supported currencies:
```php
return Frankfurter::currencies();
```
### Other methods
You can pass an array to the `setSymbols` method to limit the query to only specified symbols:
```php
Frankfurter::setSymbols(['INR','JPY','GBP'])->latest();
```
You can also set the base currency using the `setBaseCurrency` method:
```php
Frankfurter::setBaseCurrency(['GBP'])->latest();
```
### Configuration
You can publish the `frankfurter.php` config file by running:
```bash
php artisan vendor:publish --provider="Investbrain\Frankfurter\FrankfurterServiceProvider" --tag=config
```
In the config file, you can adjust your base currency and the base url (if you're self hosting Frankfurter).