2017 © Pedro Peláez
 

library yii2-phone-formatter

Phone numbers formatter and behavior for Yii2 Framework

image

uniqby/yii2-phone-formatter

Phone numbers formatter and behavior for Yii2 Framework

  • Wednesday, April 6, 2016
  • by uniqby
  • Repository
  • 2 Watchers
  • 2 Stars
  • 2,173 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 36 % Grown

The README.md

yii2-phone-formatter

Phone numbers formatter and behavior for Yii2 Framework, (*1)

Composer

The preferred way to install this extension is through Composer., (*2)

Either run, (*3)

php composer.phar require uniqby/yii2-phone-formatter "dev-master"

or add, (*4)

"uniqby/yii2-phone-formatter": "dev-master"

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

Configuration

Configure your application in common config:

'components' => [
    'formatter' => [
        'class' => 'uniqby\phoneFormatter\i18n\Formatter',
    ]
]

Now you can use asPhoneE164 and asPhoneInt methods, (*6)

echo \Yii::$app->formatter->asPhoneE164(
    '+375259862464',
    'BY'
);

echo \Yii::$app->formatter->asPhoneInt(
    '+375 25 986-24-64',
    'BY'
);

Behavior

You can add behavior to your models, (*7)

/**
 * @inheritdoc
 */
public function behaviors()
{
    return [
        'convertPhone' => [
            'class' => PhoneFormatterBehavior::className(),
            'attributes' => [
                'number'
            ]
        ]
    ];
}

The Versions

06/04 2016

dev-master

9999999-dev

Phone numbers formatter and behavior for Yii2 Framework

  Sources   Download

MIT

The Requires

 

by Alexander Sazanovich

06/04 2016

0.2.1

0.2.1.0

Phone numbers formatter and behavior for Yii2 Framework

  Sources   Download

MIT

The Requires

 

by Alexander Sazanovich

27/11 2015

0.2

0.2.0.0

Phone numbers formatter and behavior for Yii2 Framework

  Sources   Download

MIT

The Requires

 

by Alexander Sazanovich

27/11 2015

0.1

0.1.0.0

Phone numbers formatter and behavior for Yii2 Framework

  Sources   Download

MIT

The Requires

 

by Alexander Sazanovich