承接 antonienko/money-formatter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

antonienko/money-formatter

最新稳定版本:v2.0

Composer 安装命令:

composer require antonienko/money-formatter

包简介

Formatter for moneyphp/money library using alcohol/iso4217 for obtaining the number of decimal digits in each currency

README 文档

README

Run Status Scrutinizer Code Quality Code Coverage Build Status

Class to convert Moneyphp/money objects to the base unit representation of the given currency (float) or to a string representation given a locale, using php's intl extension.

To do so it leverages the info provided by the iso4217 library from Alcohol in order to know the exact number of decimal places that each currency uses.

##Installation ###Composer This library is available in packagist.org, you can add it to your project via Composer.

In the "require" section of your composer.json file:

Always up to date (bleeding edge, API not guaranteed stable)

"antonienko/money-formatter": "dev-master"

Specific minor version, API stability

"antonienko/money-formatter": "2.0.*"

Features

  • Convert a Money Object to float value, depending on the number of decimal places used by the currency.
  • Convert a Money Object to string, formatted using the provided locale.
  • Get the currency symbol of a Money Object, either just the symbol or the full currency symbol (The "just the symbol" option for Canadian Dollar would be '$', but if you are in the USA you would need the "full symbol" option "CA$")
  • Get the symbol position for a given locale (right or left position)

##Sample Usage

use antonienko\MoneyFormatter\MoneyFormatter;
use Money\Currency;
use Money\Money;

$some_euros   = new Money(300005, new Currency('EUR'));
$some_dollars = new Money(300005, new Currency('USD'));
$mf = new MoneyFormatter('fr_FR');

$amount = $mf->toFloat($some_euros); //$amount will be (float)3000.05

$french_formatted = $mf->toString($some_euros); //$french_formatted will be '3 000,05 €'

$just_symbol = $mf->toSymbol($some_dollars); //$just_symbol would be '$'

$full_symbol = $mf->toSymbol($some_dollars, false); //$full_symbol would be '$US'

$position = $mf->getSymbolPosition($some_euros); //position would be MoneyFormatter::SYMBOL_POSITION_RIGHT

##License Information Licensed under The MIT License (MIT). See the LICENSE file for more details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-14