PHP code example of integready / yii2-intl-tel-input
1. Go to this page and download the library: Download integready/yii2-intl-tel-input 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/ */
namespace frontend\models;
use integready\extensions\phoneInput\PhoneInputValidator;
class Company extends Model
{
public $phone;
public function rules()
{
return [
[['phone'], 'string'],
[['phone'], PhoneInputValidator::class],
];
}
}
namespace frontend\models;
use integready\extensions\phoneInput\PhoneInputValidator;
class Company extends Model
{
public $phone;
public function rules()
{
return [
[['phone'], 'string'],
// [['phone'], PhoneInputValidator::className(), 'region' => 'UA'],
[['phone'], PhoneInputValidator::className(), 'region' => ['PL', 'UA']],
];
}
}
namespace frontend\models;
use integready\extensions\phoneInput\PhoneInputBehavior;
class Company extends Model
{
public $phone;
public function behaviors()
{
return [
'phoneInput' => PhoneInputBehavior::class,
];
}
}
namespace frontend\models;
use integready\extensions\phoneInput\PhoneInputBehavior;
class Company extends Model
{
public $phone;
public $countryCode;
public function behaviors()
{
return [
[
'class' => PhoneInputBehavior::class,
'countryCodeAttribute' => 'countryCode',
],
];
}
}
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.