alxdorosenco/ecb-rates 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alxdorosenco/ecb-rates

最新稳定版本:v1.0.1

Composer 安装命令:

composer require alxdorosenco/ecb-rates

包简介

This package uses exchange reference rates from European Central Bank

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Currency rate convertor from European Central Bank

Url to the latest rate attributes: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

Url to the archived rate attributes: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml

Installation

Require this package with Composer

$ composer require alxdorosenco/ecb-rates

Usage

Latest rate attributes

<?php

require __DIR__ . '/vendor/autoload.php';
use AlxDorosenco\EcbRates\CurrencyRates;

// Latest rate attributes initialization
$daily = CurrencyRates::daily();

// Exchange 20 EUR to USD
$daily->rate(20, 'EUR', 'USD');

// Exchange 20 EUR to USD - special option
$daily->euroTo(20, 'USD');

// Exchange 20 USD to JPY
$daily->rate(20, 'USD', 'JPY');

History rate attributes

<?php

require __DIR__ . '/vendor/autoload.php';

use AlxDorosenco\EcbRates\CurrencyRates;

$history = CurrencyRates::history(); // History rate attributes initialization

// Get array of the rate attributes to the 2021-02-10 date
$history->findByDate('2021-02-10');

// Exchange 20 EUR to USD from the rate attributes to the 2021-02-10 date
$history->findByDate('2021-02-10')->rate(20, 'EUR', 'USD');

// Exchange 20 EUR to USD from the rate attributes to the 2021-02-10 date - special option
$history->findByDate('2021-02-10')->euroTo(20, 'EUR', 'USD');

// Get array of the latest rate attributes
$history->findByDate();  

// Exchange 20 EUR to USD from the latest rate attributes
$history->rate(20, 'EUR', 'USD');

// Exchange 20 EUR to USD from the latest rate attributes - special option
$history->rate(20, 'EUR', 'USD')->euroTo(20, 'EUR', 'USD');

All possible currency codes:

  • USD
  • JPY
  • BGN
  • CZK
  • DKK
  • GBP
  • HUF
  • PLN
  • RON
  • SEK
  • CHF
  • ISK
  • NOK
  • HRK
  • RUB
  • TRY
  • AUD
  • BRL
  • CAD
  • CNY
  • HKD
  • IDR
  • ILS
  • INR
  • KRW
  • MXN
  • MYR
  • NZD
  • PHP
  • SGD
  • THB
  • ZAR

统计信息

  • 总下载量: 7.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-07