brunoinds/paraguay-dolar-laravel

v1.1.0 2024-04-03 12:10 UTC

This package is auto-updated.

Last update: 2024-09-13 00:46:57 UTC


README

一个简单的PHP库,用于根据bcp.gov.py进行货币兑换

Total Downloads Latest Stable Version License

安装

使用Composer安装

composer require brunoinds/paraguay-dolar-laravel

用法

Exchange 类提供了PYG和USD之间的兑换方法

use Brunoinds\ParaguayDolarLaravel\Exchange;
use Brunoinds\ParaguayDolarLaravel\Enums\Currency;

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

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

Currency 枚举提供了支持货币的常量

use Brunoinds\ParaguayDolarLaravel\Enums\Currency;

Currency::USD;
Currency::PYG;

测试

单元测试位于 tests 目录中。运行测试使用

composer test

贡献

欢迎提交Pull请求!

许可

MIT许可

如果您想扩展任何部分或有任何其他反馈,请告诉我!