nwidart/money-formatter 问题修复 & 功能扩展

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

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

nwidart/money-formatter

Composer 安装命令:

composer require nwidart/money-formatter

包简介

A money formatting package.

README 文档

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

A simple package used for formatting a Money\Money value object.

Money is usually not stored as a float in your database, though your clients/users don't want to see 1000 meaning, 10. This package receives an amount in cents, and displays it according to the given locale with or with the currency symbol.

Want to use this inside a Laravel application? Check out the MoneyFormatter-Laravel package.

Install

Via Composer

$ composer require nwidart/money-formatter

Usage

To format money in cents:

$formatter = new MoneyFormatter('en_US');
$formattedMoney = $formatter->format(new Money(1000, new Currency('USD')));
# output : $10.00

Sometimes you may wish to not have the currency symbol, this can be done like so:

$formatter = new MoneyFormatter('en_US');
$formattedMoney = $formatter->formatWithoutCurrency(new Money(1000, new Currency('USD')));
# output : 10.00

This can be useful if your currency selection is a separate dropdown, for instance.

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固