2017 © Pedro Peláez
 

yii2-extension yii2-countries

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

image

akavov/yii2-countries

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  • Tuesday, December 20, 2016
  • by akaVoV
  • Repository
  • 1 Watchers
  • 1 Stars
  • 455 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Widget Countries in the world with flags

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags, (*1)

Thanks to:, (*2)

https://github.com/victordzmr/Countries https://github.com/lipis/flag-icon-css https://github.com/2amigos/yii2-selectize-widget, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

php composer.phar require --prefer-dist akavov/yii2-countries "*"

or add, (*6)

"akavov/yii2-countries": "*"

Migration

you can use migrations that already exist in console/migartions, (*7)

$ yii migrate --migrationPath='@akavov/countries/console/migrations'

or, (*8)

$ yii migrate --migrationPath=@vendor/akavov/yii2-countries/console/migrations

it will create tables: 1. country - with some data (249 countries in english[name_en]) in it 2. post_country_assn - depends from table post and table country, (*9)

You can use this migartions like an example and create needed tables yourself, (*10)

Configuring

Configure model as follows, (*11)

 CountriesBehavior::className(),
            ],
            ...
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ...
            ['countryValues', 'safe'],
            ...
        ];
    }

    public function transactions()
    {
        return [
            self::SCENARIO_DEFAULT => self::OP_ALL,
        ];
    }

    public function getCountries()
    {
        return $this->hasMany(Country::className(), ['id' => 'country_id'])
            ->viaTable('{{%post_country_assn}}', ['post_id' => 'id']);
    }

}

```

Usage
-----

```
    = $form->field($model, 'countryValues')
    ->widget(akavov\countries\widgets\CountriesSelectizeTextInput::className(), [
        'customRender' => [
            'item'  => '
  {escape(item.name_en)}
', 'option' => '
  {escape(item.name_en)}
', ], 'clientOptions' => [ 'valueField' => 'name_en', 'labelField' => 'name_en', 'searchField' => ['name_en', 'name_uk', 'name_ru'], 'plugins' => ['remove_button'], 'closeAfterSelect' => true, 'maxItems' => 10, 'delimiter' => ',', 'persist' => false, 'preload' => true, 'items' => $model->countryValues, 'create' => false, ], ]); ?>

The Versions

20/12 2016

dev-master

9999999-dev

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  Sources   Download

MIT

The Requires

 

by Avatar akaVoV

extension yii2 behavior country iso 3166-1 numeric code iso 3166-1 alpha-2 code itu-t calling code and name flags

20/12 2016

0.9.2.1

0.9.2.1

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  Sources   Download

MIT

The Requires

 

by Avatar akaVoV

extension yii2 behavior country iso 3166-1 numeric code iso 3166-1 alpha-2 code itu-t calling code and name flags

29/12 2015

0.9.2

0.9.2.0

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  Sources   Download

MIT

The Requires

 

by Avatar akaVoV

extension yii2 behavior country iso 3166-1 numeric code iso 3166-1 alpha-2 code itu-t calling code and name flags

24/09 2015

0.9.1

0.9.1.0

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  Sources   Download

MIT

The Requires

 

by Avatar akaVoV

extension yii2 behavior country iso 3166-1 numeric code iso 3166-1 alpha-2 code itu-t calling code and name flags

23/09 2015

0.9.0

0.9.0.0

ISO 3166-1 numeric code, ISO 3166-1 alpha-2 code, ITU-T calling code and name (English, Russian and Ukrainian) for all the countries in the world with their flags

  Sources   Download

MIT

The Requires

 

by Avatar akaVoV

extension yii2 behavior country iso 3166-1 numeric code iso 3166-1 alpha-2 code itu-t calling code and name flags