承接 mcuadros/currency-detector 相关项目开发

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

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

mcuadros/currency-detector

Composer 安装命令:

composer require mcuadros/currency-detector

包简介

Class to detect the currency from any string

README 文档

README

Class to detect the currency from any string, support +100 currencies.

Requirements

  • PHP 5.4.x

Installation

The recommended way to install CurrencyDetector is through composer. You can see the package information on Packagist.

{
    "require": {
        "mcuadros/currency-detector": "dev-master"
    }
}

Usage

getCurrency

Returns a string with the most common currency.

$detector = new Detector();
echo $detector->getCurrency('11.10$');
//Returns: USD

getCurrencies

Returns all the currencies suitable for this string.

$detector = new Detector();
echo $detector->getCurrencies('11.10$');
//Returns: ['USD', 'AUD', 'CAD', ...]

getAmount

Return a money string as a float

$detector = new Detector();
echo $detector->getAmount('11,10.00$');
//Returns: 1110.00

Tests

Tests are in the tests folder. To run them, you need PHPUnit. Example:

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-11-04