PHPackages                             brunoinds/sunat-dolar - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. brunoinds/sunat-dolar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brunoinds/sunat-dolar
=====================

Calculate SUNAT Perú dollar exchange

v1.0.0(2y ago)069PHP

Since Dec 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/brunoinds/php-sunat-dolar)[ Packagist](https://packagist.org/packages/brunoinds/sunat-dolar)[ RSS](/packages/brunoinds-sunat-dolar/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP SUNAT Peru Currency Exchange
================================

[](#php-sunat-peru-currency-exchange)

A simple PHP library for exchanging currencies based on Peruvian SUNAT exchange rates.

Installation
------------

[](#installation)

Install via Composer:

```
composer require brunoinds/sunat-dolar
```

Usage
-----

[](#usage)

The `Exchange` class provides methods for exchanging between PEN and USD:

```
use Brunoinds\SunatDolar\Exchange;
use Brunoinds\SunatDolar\Enums\Currency;

// Get current exchange rate
$result = Exchange::now()->convert(Currency::USD, 1)->to(Currency::PEN);

// Get historical exchange rate
$date = new DateTime('2023-12-10');
$result = Exchange::on($date)
                ->convert(Currency::USD, 1)
                ->to(Currency::PEN);
echo $result // 0.27

// Get buy/sell prices
$dollarBuy = Exchange::on($date)->getDollarBuyPrice(); //3.749;
$solesSell = Exchange::on($date)->getSolesSellPrice(); //0.266
```

The `Currency` enum provides constants for the supported currencies:

```
use Brunoinds\SunatDolar\Enums\Currency;

Currency::USD; // 'USD'
Currency::PEN; // 'PEN'
```

Testing
-------

[](#testing)

Unit tests are located in the `tests` directory. Run tests with:

```
composer test

```

Contributing
------------

[](#contributing)

Pull requests welcome!

License
-------

[](#license)

MIT License

Powered by:
-----------

[](#powered-by)

- [API Tipo de cambio SUNAT](https://apis.net.pe/api-tipo-cambio.html)

Let me know if you would like any sections expanded or have any other feedback!

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

917d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54acc3d3fd4f73272aaec761ab85bf40397736e250431ec7c1cb34de791e9f18?d=identicon)[brunoinds](/maintainers/brunoinds)

---

Top Contributors

[![brunoinds](https://avatars.githubusercontent.com/u/49789611?v=4)](https://github.com/brunoinds "brunoinds (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brunoinds-sunat-dolar/health.svg)

```
[![Health](https://phpackages.com/badges/brunoinds-sunat-dolar/health.svg)](https://phpackages.com/packages/brunoinds-sunat-dolar)
```

###  Alternatives

[frictionlessdata/tableschema

A utility library for working with Table Schema

12210.9k7](/packages/frictionlessdata-tableschema)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

15133.0k](/packages/withcandour-aardvark-seo)

PHPackages © 2026

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