PHPackages                             abdelrahmanbadr/currency-rates - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. abdelrahmanbadr/currency-rates

ActiveLibrary

abdelrahmanbadr/currency-rates
==============================

Library for interacting with exchangeratesapi currency exchange rates APIs

014[1 PRs](https://github.com/abdelrahmanbadr/currency-rates/pulls)PHP

Since Jun 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/abdelrahmanbadr/currency-rates)[ Packagist](https://packagist.org/packages/abdelrahmanbadr/currency-rates)[ RSS](/packages/abdelrahmanbadr-currency-rates/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

currency-rates
==============

[](#currency-rates)

Installation:
-------------

[](#installation)

Currency Rates Package supports Laravel 5.5 and higher.

Package Require via composer:
-----------------------------

[](#package-require-via-composer)

- composer require abdelrahmanbadr/currency-rates
- In your .env file set exchangeratesapi url in EXCHANGE\_RATES\_API\_URL
- In your .env file set cache enabled or disabled (true or false) CURRENCY\_RATES\_CACHE\_IS\_ENABLED
- In your .env file set expiry time for cache (integer) CURRENCY\_RATES\_CACHE\_EXPIRY

### Usage:

[](#usage)

Let's get the rates of EUR and GBP with USD as the base currency:

```
use Abdelrahman_badr\CurrencyRates\Core\Facades\CurrencyService;

$currency = CurrencyService::getLatest("EUR",["GBP","USD"]);

$rates = $currency->rates;
```

By default, the base currency is `EUR`, so if that's your base, there's no need to set it. The symbols can be omitted too, as Exchange Rates Api will return all the supported currencies.

A simplified example without the base and currency:

```
$currency = CurrencyService::getLatest();
```

The `historical` option will return currency rates for every day since the dates you've specified. The base currency and symbols can be omitted here to, but let's see a full example:

```
$currency = CurrencyService::getHistorical(new \DateTime(),(new \DateTime())->modify('-15 days'),"EUR",["GBP","USD"]);
```

This will get available rates from 15 days ago till today

`export latest rates to csv` take the file name and same parameters for `getLatest` function

```
CurrencyService::exportLatest('fliename');
```

`export historical rates to csv` take the file name and same parameters for `getHistorical` function

```
CurrencyService::exportHistorical('fliename',new \DateTime(),new \DateTime("2019-01-01"));
```

Running Unit tests:
-------------------

[](#running-unit-tests)

```
$ ./vendor/bin/phpunit

```

Nice To Have (@Todo):
---------------------

[](#nice-to-have-todo)

```
1. Add Cli Command To Get Currency Exchange Rates
2- More validation for package user inputs
3- Create convert service like convert 100 USD to EUR
4- Add more providers such as Fixerio and make config switch between them
5- Add logs to trace errors
6- Use transform layer for the result
7- Use config file

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/75929bc9d8204d1c47faa29a0a31517291595529bb847ca8fec62848749fd472?d=identicon)[abdelrahmanbadr](/maintainers/abdelrahmanbadr)

---

Top Contributors

[![abdelrahmanbadr](https://avatars.githubusercontent.com/u/16999130?v=4)](https://github.com/abdelrahmanbadr "abdelrahmanbadr (27 commits)")[![abdelrahman-scratch](https://avatars.githubusercontent.com/u/72406829?v=4)](https://github.com/abdelrahman-scratch "abdelrahman-scratch (2 commits)")

### Embed Badge

![Health badge](/badges/abdelrahmanbadr-currency-rates/health.svg)

```
[![Health](https://phpackages.com/badges/abdelrahmanbadr-currency-rates/health.svg)](https://phpackages.com/packages/abdelrahmanbadr-currency-rates)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
