定制 fortis/iso-currency 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

fortis/iso-currency

最新稳定版本:1.0.1

Composer 安装命令:

composer require fortis/iso-currency

包简介

A PHP library providing ISO 4217 currencies. Work with currencies by the standard to avoid confusions.

README 文档

README

Travis Coveralls Packagist FOSSA Status

Very simple and easy-to-use Currency class to work with ISO 4217 currencies as they provided by the official ISO Maintenance Agency

What is ISO 4217

ISO 4217 is a standard published by the International Organization for Standardization, which delineates currency designators, country codes (alpha and numeric), and references to minor units in three tables.

-- Wikipedia

Install

Install directly from command line using Composer

composer require fortis/iso-currency

Use

Don't type currency codes as strings, instead it's better to use constants from auto generated CurrencyCode class as it's always up-to-date with currency-iso.org and helps you avoid typos. For example, use CurrencyCode::USD instead of 'USD'. Autocomplete will make it easier.

Also you can create new currency object with Currency class and autocomplete: new Currency::USD().

// Create Currency instance.
$currency = new Currency(CurrencyCode::EUR);     // constructor  
$currency = Currency::create(CurrencyCode::EUR); // static factory method
$currency = Currency::EUR();                     // short syntax with autocomplete on ::

// Currency code validation.
$currency = new Currency('EUE'); // throws InvalidCurrencyException

// Check whether the given Currency is USD/EUR/etc.
$currency = new Currency(CurrencyCode::EUR);
$currency->is(Currency::EUR()); // true
$currency->is(Currency::USD()); // false

License

iso-currency is licensed under the MIT license.

FOSSA Status

Source(s)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-09