andrey-helldar / digittext
5.0.2
2018-09-06 20:36 UTC
Requires
- php: >=7.1
- ext-intl: *
- illuminate/http: ^5.5
- illuminate/pipeline: ^5.5
- illuminate/routing: ^5.5
- illuminate/session: ^5.5
- illuminate/support: ^5.5
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.2
README
该模块可以将数字转换为文本等价物。这在计费中很重要。
注意!
此包已被废弃,不再维护。作者建议使用 kwn/number-to-words 包。
安装
要获取 DigitText 的最新版本,只需使用 Composer 依赖此项目。
$ composer require andrey-helldar/digittext
当然,您也可以手动更新 require 块并运行 composer update
。
{ "require": { "andrey-helldar/digittext": "^5.0" } }
如果您不使用自动发现,请将 ServiceProvider 添加到 config/app.php
中的 providers 数组中。
Helldar\DigitText\ServiceProvider::class,
现在,使用 DigitText
Facade 或 digit_text()
辅助函数。
文档
您可以使用辅助函数
digit_text($number = 0, string $lang = 'en', bool $is_currency = false);
或直接访问类 "Helldar\DigitText\DigitText"
(new DigitText) ->get($number = 0, string $lang = 'en', bool $is_currency = false);
示例
echo digit_text(null); // zero echo digit_text(64.23); // sixty four echo digit_text(2866); // two thousands eight hundred sixty six echo digit_text(2866, 'ru'); // две тысячи восемьсот шестьдесят шесть echo digit_text(0, 'en', true); // zero dollar echo digit_text(64.23, 'en', true); // sixty four dollars 23 cents echo digit_text(2866, 'en', true); // two thousands eight hundred sixty six dollars echo digit_text(2866, 'ru', true); // две тысячи восемьсот шестьдесят шесть руб
支持的语言
EN - English
DE - Deutsch
RU - Русский
UK - Український
版权和许可
DigitText 为 Laravel 框架 5.5 或更高版本编写,并遵循 MIT 许可 发布。