承接 linuxartisan/tomoney 相关项目开发

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

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

linuxartisan/tomoney

Composer 安装命令:

composer require linuxartisan/tomoney

包简介

A library to convert a number in various money formats

README 文档

README

A simple PHP library to convert a number to money format.

Installation

With Composer

$ composer require linuxartisan/tomoney

Alternatively, you may add the following in composer.json file.

{
    "require": {
        "linuxartisan/tomoney": "*"
    }
}

And then execute

$ composer install

After installation, to dump the autoloader, execute

$ composer dump-autoload

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use LinuxArtisan\ToMoney\Money;

echo Money::formatToIndian(123456127.73); // to Indian
// "12,34,56,127.73"

echo Money::formatToUS(123456127.73); // to US
// "123,456,127.73"

echo Money::formatTo('en_GB', 123456127.73); // to custom
// "123,456,127.73"

Numeric values may be passed as strings too

echo Money::formatToIndian('12345.67'); // to Indian
echo Money::formatToUS('1234.56'); // to US
echo Money::formatTo('en_GB', '1234.56'); // to custom

But this is not recommended, as a non-numeric string will be returned as '0'.

return Money::formatTo('en_GB', "12abcd127.731");

will return 0 as a string.

Also, if a particular locale is not supported, the same amount will be returned as a string without formatting.

return Money::formatTo('some_unsupported_locale', 12345);
// "12345"

Note

To view all the available locales on your system, give the following command in the terminal

$ locale -a

These locales may be used as argument to the formatTo function.

Find me here:

Contact me on Codementor

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固