{"id":28558679,"url":"https://github.com/integready/yii2-intl-tel-input","last_synced_at":"2025-10-24T02:20:35.790Z","repository":{"id":56950840,"uuid":"47972833","full_name":"IntegReady/yii2-intl-tel-input","owner":"IntegReady","description":"International Tel Input Widget for Yii2","archived":false,"fork":false,"pushed_at":"2019-10-23T12:48:13.000Z","size":598,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T07:27:51.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntegReady.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-14T12:07:07.000Z","updated_at":"2019-10-23T12:47:55.000Z","dependencies_parsed_at":"2022-08-21T03:40:18.395Z","dependency_job_id":null,"html_url":"https://github.com/IntegReady/yii2-intl-tel-input","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegReady%2Fyii2-intl-tel-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegReady%2Fyii2-intl-tel-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegReady%2Fyii2-intl-tel-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegReady%2Fyii2-intl-tel-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntegReady","download_url":"https://codeload.github.com/IntegReady/yii2-intl-tel-input/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntegReady%2Fyii2-intl-tel-input/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259033852,"owners_count":22795775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T08:09:39.654Z","updated_at":"2025-10-24T02:20:30.737Z","avatar_url":"https://github.com/IntegReady.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget\n================================================================================\n\nThis extension uses 2 libraries:\n\n- [A jQuery plugin for entering and validating international telephone numbers](https://github.com/Bluefieldscom/intl-tel-input)\n- [PHP version of Google's phone number handling library](https://github.com/giggsey/libphonenumber-for-php)\n\n## Installation\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```bash\n$ php composer.phar require \"integready/yii2-intl-tel-input\" \"~2.0.0\"\n```\n\nor add\n\n```\n\"integready/yii2-intl-tel-input\": \"~2.0.0\"\n```\n\nto the `require` section of your `composer.json` file.\n\n## Usage\n\nUsing as an `ActiveField` widget with the preferred countries on the top:\n\n```php\nuse integready\\extensions\\phoneInput\\PhoneInput;\n\necho $form-\u003efield($model, 'phone_number')-\u003ewidget(PhoneInput::class, [\n    'jsOptions' =\u003e [\n        'preferredCountries' =\u003e ['no', 'pl', 'ua'],\n    ]\n]);\n```\n\nUsing as a simple widget with the limited countries list:\n\n```php\nuse integready\\extensions\\phoneInput\\PhoneInput;\n\necho PhoneInput::widget([\n    'name' =\u003e 'phone_number',\n    'jsOptions' =\u003e [\n        'allowExtensions' =\u003e true,\n        'onlyCountries' =\u003e ['no', 'pl', 'ua'],\n    ]\n]);\n```\n\nUsing phone validator in a model (validates the correct country code and phone format):\n\n```php\nnamespace frontend\\models;\n\nuse integready\\extensions\\phoneInput\\PhoneInputValidator;\n\nclass Company extends Model\n{\n    public $phone;\n\n    public function rules()\n    {\n        return [\n            [['phone'], 'string'],\n            [['phone'], PhoneInputValidator::class],\n        ];\n    }\n}\n```\n\nor if you need to validate phones of some countries:\n\n```php\nnamespace frontend\\models;\n\nuse integready\\extensions\\phoneInput\\PhoneInputValidator;\n\nclass Company extends Model\n{\n    public $phone;\n\n    public function rules()\n    {\n        return [\n            [['phone'], 'string'],\n            // [['phone'], PhoneInputValidator::className(), 'region' =\u003e 'UA'],\n            [['phone'], PhoneInputValidator::className(), 'region' =\u003e ['PL', 'UA']],\n        ];\n    }\n}\n```\n\nUsing phone behavior in a model (auto-formats phone string to the required phone format):\n\n```php\nnamespace frontend\\models;\n\nuse integready\\extensions\\phoneInput\\PhoneInputBehavior;\n\nclass Company extends Model\n{\n    public $phone;\n\n    public function behaviors()\n    {\n        return [\n            'phoneInput' =\u003e PhoneInputBehavior::class,\n        ];\n    }\n}\n```\n\nYou can also thanks to this behavior save to database country code of the phone number. Just add your attribute as\n `countryCodeAttribute` and it'll be inserted into database with the phone number.\n\n\n```php\nnamespace frontend\\models;\n\nuse integready\\extensions\\phoneInput\\PhoneInputBehavior;\n\nclass Company extends Model\n{\n    public $phone;\n    public $countryCode;\n\n    public function behaviors()\n    {\n        return [\n            [\n                'class'                =\u003e PhoneInputBehavior::class,\n                'countryCodeAttribute' =\u003e 'countryCode',\n            ],\n        ];\n    }\n}\n```\n\n\u003e Note: `nationalMode` option is very important! In case if you want to manage phone numbers with country/operator code\n- you have to set `nationalMode: false` in widget options \n(for example, `PhoneInput::widget(...options, ['jsOptions' =\u003e ['nationalMode' =\u003e false]])`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegready%2Fyii2-intl-tel-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintegready%2Fyii2-intl-tel-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegready%2Fyii2-intl-tel-input/lists"}