Skip to content

grenhaz/yii2-formattednumber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Formatted Number Extension for Yii 2

For license information check the LICENSE-file.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist grenhaz/yii2-formattednumber

or add

"grenhaz/yii2-formattednumber": "~1.0.0"

to the require section of your composer.json.

Basic Usage

<?= $form->field( $model, 'number' )
        ->widget( FormattedNumberWidget::classname(), [
            "plugin" => [
                "decimals" => 2
            ]
        ] ) ?>

Example

Example

Configuration

  • decimals - Number of decimals to show. default: 2
  • thousandSeparator - Thousand separator character. default: (empty)
  • decimalSeparator - Decimal separator character. default: .
  • emptyAllowed - Allow empty values. default: true
  • forceDecimals - Force to show or not all decimals. default: true
  • align - Text alignment. default: right