定制 illusive-man/converter 二次开发

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

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

illusive-man/converter

Composer 安装命令:

composer require illusive-man/converter

包简介

Convertes number to its text representation

README 文档

README

Latest Stable Version Build Status Scrutinizer Code Quality Code Climate Code Coverage

Compact PHP Library that converts given numeric value to its written text representation (in Russian). At first I wanted Number2Text to be Universal library, but considering amount of similar classes for other languages I stopped at using only Russian wording. Maybe I will extend it for English just for varity sake ;)

INFO

Number2Text is capable of lightning fast conversion for numbers from negative 1e+510 to positive 1e+510. Sure, in real life it has no practical application for numberes over quadrillion I think, but isn't it cool, is it?!

INSTALLATION

It's very easy. Go to your project root directory and run this command:

composer require illusive-man/converter

USAGE

Include your autoload.php file and type use statement for the class like this:

require_once 'vendor/autoload.php';
use Converter\Core\Number2Text;

Instantiate the class. If you need currency shown, uncomment second line:

$number = new Number2Text();
//$number->currency(true);

Well, the only thing left to do is a number we want to convert and method, thal will do all the magic.

$number = '1051650555165450046516654000654640690000959555987960054106514';
echo $test->convert($number);

NOTE: Since we're working with numbers way beyound bigger than even 64-bit php_max_int() ones, always pass a number as string!

AFTERWORDS

The secondary reason behind this converter was the fact that most of the previously created apps and tools (e.g. Number Words and some based on it) of the same kind are unnecessarily overcomplicated and sometimes not working properly (Online converter tools like easycalculation.com or tools4noobs.com - both are working wrong for Russian).

Actually, most of "universal converters" are working wrong for complex languages like Russian. Also, big chunk of those translators doesn't support PHP 7.0+. This one does. Plus the Library is very very fast (0.0001s for big numbers like 1e+500 with random digits) even with enormous numbers and consists only of two files.

But the main reason for creating this Library, maintaining it with Travis CI and Scrutinizer, using VCS like GitHub, is pure greed for knowledge and learning such a beautiful development language - PHP. I deliberately made it of one file Class (actually two, but second is just the Data array) so feel free to modify it or maybe make a pull request if you can refactor it to become even more compat and/or fast.

Enjoy!

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固