Skip to content

Yii2 address form module with depoendent dropdowns for 250 countries & regions

Notifications You must be signed in to change notification settings

TonisOrmisson/yii2-address-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Address-form module

Scrutinizer Code Quality Build Status Code Coverage

A module doing address-form fields with dependent pre-set country-region drop-downs. Countries & regions powered by:

powered by rinvex/countries

250 countries & regions worldwide available

Example

add module config

the module part will take care of dep-drop ajax queries


    'modules' => [
        //...
        'addressform' =>[
            'class' => \tonisormisson\addressform\Module::class,
        ],
        //...
    ]

place the widet

use tonisormisson\addressform\AddressForm; 

echo AddressForm::widget([
    'allowedCountries' => ["EE", "LV", "LT"],
    'defaultCountry' => "EE",
    'placeHolders' = [
        // custom placeholders here if needed
        'country' => ,
        'state' => ,
        'city' => ,
        'postCode' => ,
        'addressLine1' => ,
        'addressLine2' => ,
    ],
            
]);

and catch the address in controller

use tonisormisson\addressform\models\Address;
$address = new Address();
$address->load(Yii::$app->request->post());

// load the address to your models
// eg :
$model->address_data = Json::encode($address);

About

Yii2 address form module with depoendent dropdowns for 250 countries & regions

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages