mibo/currencies 问题修复 & 功能扩展

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

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

mibo/currencies

最新稳定版本:1.2.2

Composer 安装命令:

composer require mibo/currencies

包简介

PHP Library of ISO-4217 standard

README 文档

README

codecov

Based on ISO-4217

Implementation

composer require mibo/currencies

Usage

To find a currency:

$factory = new \MiBo\Engine\Utils\Currencies\ISO\ISOCurrencyProvider(); // Get By Alphabetic Code ("EUR") $currency = $factory->findByAlphabeticalCode("EUR"); // Get By Numerical Code ("012") $currency = $factory->findByNumericalCode("123"); // Get By Country Name // Returns an array of currencies $currencies = $factory->findByCountry("CZECHIA");

To change list of available currencies to

  • add custom currencies;
  • allow only some currencies;
  • change currencies' data the list(s) can be overwritten:
$factory->getLoader()->setResources(\MiBo\Engine\Utils\Currencies\ISO\ISOListLoader::SOURCE_LOCAL); 

Find by country

One should try to avoid looking for a currency by a country.
While other functions stops looping through lists when the needed currency is found, the getCurrencyByCountry function keeps looking for currency until the end of last file in list. This might prolong the process when one knows that a country uses only one currency and knows a code of the currency.

Currency Class

$currency = new \MiBo\Engine\Utils\Currencies\ISO\ISOCurrency(/*...*/); $currency->getAlphabeticalCode(); // "EUR" $currency->getNumericalCode(); // "978" $currency->getName(); // "Euro" $currency->getMinorUnitRate(); // 2|null

Minor Unit Rate

Is used to specify, how many digits there are for the currency after decimal point.
Few of the currencies do not have a minor unit.
An example for minor unit can be "cent" for "Euro".

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固