PHP code example of uniqby / yii2-phone-formatter
1. Go to this page and download the library: Download uniqby/yii2-phone-formatter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uniqby / yii2-phone-formatter example snippets
'components' => [
'formatter' => [
'class' => 'uniqby\phoneFormatter\i18n\Formatter',
]
]
echo \Yii::$app->formatter->asPhoneE164(
'+375259862464',
'BY'
);
echo \Yii::$app->formatter->asPhoneInt(
'+375 25 986-24-64',
'BY'
);
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'convertPhone' => [
'class' => PhoneFormatterBehavior::className(),
'attributes' => [
'number'
]
]
];
}
php composer.phar