2017 © Pedro Peláez
 

yii2-extensions yii2-human-formatter

image

microinginer/yii2-human-formatter

  • Friday, August 14, 2015
  • by inginer
  • Repository
  • 1 Watchers
  • 7 Stars
  • 688 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

yii2-human-formatter

This formatter for yii2 which extend basic formatter. Override datetime and add method of formatting phones (only Russia's number), (*1)

russian readme, (*2)

Example

echo Yii::$app->formatter->asDatetime(time()); // 0 seconds ago
echo Yii::$app->formatter->asDatetime(strtotime('- 1 day')); // Yesterday at 11:55 pm
echo Yii::$app->formatter->asDatetime('2014-08-23 23:55:12'); //  August 23 at 11:55 pm

echo Yii::$app->formatter->asPhone('89254552773'); //  +7 (925) 455-27-73
echo Yii::$app->formatter->asPhone('9254552773'); //  +7 (925) 455-27-73
echo Yii::$app->formatter->asPhone('925 455 27 73'); //  +7 (925) 455-27-73
echo Yii::$app->formatter->asPhone('(925) 455 27-73'); //  +7 (925) 455-27-73
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        'id',
        'title',
        'mobile:phone',
        'created_at:datetime',
        'description:ntext',
    ],
]);

Install

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist microinginer/yii2-human-formatter "dev-master"

or add, (*5)

"microinginer/yii2-human-formatter": "dev-master"

to the require section of your composer.json file., (*6)

add to config:, (*7)

$config = [
    ...
    'components' => [
        ...
        'formatter'  => [
            'class' => 'microinginer\humanFormatter\HumanFormatter',
        ]
        ...
    ]
    ...
]

The Versions

14/08 2015

dev-master

9999999-dev https://github.com/microinginer/yii2-human-formatter

  Sources   Download

MIT

The Requires

 

by Avatar inginer
by gir3li

yii2 formatter datetime human

14/08 2015

v1.0.0

1.0.0.0 https://github.com/microinginer/yii2-human-formatter

  Sources   Download

MIT

The Requires

 

by Avatar inginer
by gir3li

yii2 formatter datetime human