mibo/currencies
Composer 安装命令:
composer require mibo/currencies
包简介
PHP Library of ISO-4217 standard
README 文档
README
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".
mibo/currencies 适用场景与选型建议
mibo/currencies 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.6k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「php」 「library」 「money」 「currency」 「lib」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mibo/currencies 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mibo/currencies 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mibo/currencies 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Inbox pattern process implementation for your Laravel Applications
Simple ASCII output of array data
Core library that defines common interfaces used by the rest of the intahwebz..
Amqp classes
Provides command to manage a web library directory
统计信息
- 总下载量: 16.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 34
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-09