stratoss/yii2-money
Composer 安装命令:
composer require stratoss/yii2-money
包简介
An advanced money mask input for Yii 2.0 based on jquery maskmoney plugin styled for Bootstrap 3.
README 文档
README
An advanced money mask input for Yii Framework 2 based on jQuery-maskMoney plugin. The plugin offers a simple way to create masks to your currency form fields. The yii2-money extension includes these additional enhancements in order to use the maskMoney plugin effectively:
- default styling for Bootstrap 3 and supports Yii Active Field validations
- automatically read a float/decimal and convert it to the money format on field load
- automatically convert back the field to a float/decimal for saving once the mask is changed (maintains an internal hidden field)
- allows global settings of the mask money plugin options via
Yii::$app->params
Demo
You can see detailed documentation on usage of the extension.
Latest Release
The latest version of the extension is release v1.2.1. Refer the CHANGE LOG for details of various releases.
Installation
The preferred way to install this extension is through composer.
Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the
minimum-stabilitysettings for your application's composer.json.
Either run
$ php composer.phar require kartik-v/yii2-money "dev-master"
or add
"kartik-v/yii2-money": "dev-master"
to the require section of your composer.json file.
Usage
Global Settings
You can globally set the plugin options for your money format across the application in the params section of your Yii configuration file. You
need to set the maskMoneyOptions in your Yii application params. For example:
'params' => [ 'maskMoneyOptions' => [ 'prefix' => 'US$ ', 'suffix' => ' c', 'affixesStay' => true, 'thousands' => ',', 'decimal' => '.', 'precision' => 2, 'allowZero' => false, 'allowNegative' => false, ] ]
Formatter Settings
If you have not setup params like above, the plugin will default the thousandSeparator and decimalSeparator
from Yii::$app->formatter settings in your configuration file.
'components' => [ 'formatter' => [ 'class' => 'yii\i18n\formatter', 'thousandSeparator' => ',', 'decimalSeparator' => '.', ] ]
MaskMoney
You can configure the widget as shown below. Any plugin option not passed, will be defaulted from the above two sections (params and formatter).
Note that properties directly set in pluginOptions at the widget level as shown below, will override other global settings.
use kartik\money\MaskMoney; echo MaskMoney::widget([ 'name' => 'currency', 'value' => 122423.18, 'pluginOptions' => [ 'prefix' => '$ ', ], ]);
License
yii2-money is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.
stratoss/yii2-money 适用场景与选型建议
stratoss/yii2-money 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jquery」 「bootstrap」 「money」 「currency」 「extension」 「format」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 stratoss/yii2-money 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 stratoss/yii2-money 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 stratoss/yii2-money 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Beyonic PHP Library
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
A jQuery augmented PHP library for creating and validating HTML forms
Implementation of carouFredSel as extension for Contao Open Source CMS
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-09-06