PHPackages                             integready/yii2-int-tel-input-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. integready/yii2-int-tel-input-widget

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

integready/yii2-int-tel-input-widget
====================================

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget

2.0.0.4(6y ago)033BSD-3-ClausePHP

Since Dec 14Pushed 6y ago1 watchersCompare

[ Source](https://github.com/IntegReady/yii2-intl-tel-input)[ Packagist](https://packagist.org/packages/integready/yii2-int-tel-input-widget)[ Docs](https://github.com/IntegReady/yii2-intl-tel-input)[ RSS](/packages/integready-yii2-int-tel-input-widget/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget
================================================================================

[](#yii2-international-telephone-numbers---asset-bundle-behavior-validator-widget)

This extension uses 2 libraries:

- [A jQuery plugin for entering and validating international telephone numbers](https://github.com/Bluefieldscom/intl-tel-input)
- [PHP version of Google's phone number handling library](https://github.com/giggsey/libphonenumber-for-php)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require "integready/yii2-intl-tel-input" "~2.0.0"
```

or add

```
"integready/yii2-intl-tel-input": "~2.0.0"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

Using as an `ActiveField` widget with the preferred countries on the top:

```
use integready\extensions\phoneInput\PhoneInput;

echo $form->field($model, 'phone_number')->widget(PhoneInput::class, [
    'jsOptions' => [
        'preferredCountries' => ['no', 'pl', 'ua'],
    ]
]);
```

Using as a simple widget with the limited countries list:

```
use integready\extensions\phoneInput\PhoneInput;

echo PhoneInput::widget([
    'name' => 'phone_number',
    'jsOptions' => [
        'allowExtensions' => true,
        'onlyCountries' => ['no', 'pl', 'ua'],
    ]
]);
```

Using phone validator in a model (validates the correct country code and phone format):

```
namespace frontend\models;

use integready\extensions\phoneInput\PhoneInputValidator;

class Company extends Model
{
    public $phone;

    public function rules()
    {
        return [
            [['phone'], 'string'],
            [['phone'], PhoneInputValidator::class],
        ];
    }
}
```

or if you need to validate phones of some countries:

```
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']],
        ];
    }
}
```

Using phone behavior in a model (auto-formats phone string to the required phone format):

```
namespace frontend\models;

use integready\extensions\phoneInput\PhoneInputBehavior;

class Company extends Model
{
    public $phone;

    public function behaviors()
    {
        return [
            'phoneInput' => PhoneInputBehavior::class,
        ];
    }
}
```

You can also thanks to this behavior save to database country code of the phone number. Just add your attribute as `countryCodeAttribute` and it'll be inserted into database with the phone number.

```
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',
            ],
        ];
    }
}
```

> Note: `nationalMode` option is very important! In case if you want to manage phone numbers with country/operator code

- you have to set `nationalMode: false` in widget options (for example, `PhoneInput::widget(...options, ['jsOptions' => ['nationalMode' => false]])`).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~201 days

Recently: every ~15 days

Total

8

Last Release

2393d ago

Major Versions

1.0.2 → 2.0.02019-08-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/d657b2550bf2bed9e94d9be1d167afc6b4df78e3ecf71543765507bde253d4b4?d=identicon)[Stern87](/maintainers/Stern87)

---

Top Contributors

[![bigferumdron](https://avatars.githubusercontent.com/u/3116203?v=4)](https://github.com/bigferumdron "bigferumdron (11 commits)")[![Stern87](https://avatars.githubusercontent.com/u/13180074?v=4)](https://github.com/Stern87 "Stern87 (7 commits)")[![vityachis](https://avatars.githubusercontent.com/u/15579862?v=4)](https://github.com/vityachis "vityachis (5 commits)")

---

Tags

libphonenumberyii2intl-tel-inputinternational telephone numbers

### Embed Badge

![Health badge](/badges/integready-yii2-int-tel-input-widget/health.svg)

```
[![Health](https://phpackages.com/badges/integready-yii2-int-tel-input-widget/health.svg)](https://phpackages.com/packages/integready-yii2-int-tel-input-widget)
```

###  Alternatives

[borales/yii2-phone-input

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget

1341.6M6](/packages/borales-yii2-phone-input)[codeonyii/yii2-at-least-validator

Validates at least one (or more) attributes.

28253.5k1](/packages/codeonyii-yii2-at-least-validator)[arogachev/yii2-many-to-many

Many-to-many ActiveRecord relation for Yii 2 framework

3541.2k4](/packages/arogachev-yii2-many-to-many)[yii2mod/yii2-validators

Collection of useful validators for Yii Framework 2.0

1816.8k](/packages/yii2mod-yii2-validators)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
