Is there a Symfony2 form extension for a Country/Region/City selector?

2.8k Views Asked by At

Most things I build require someone select a country/state/city.

I'd like to add a form type to symfony to easily add chained select fields for country/state/city. So, a user would pick a country and it'd filter the states; pick a state and it would filter the cities.

This is a ridiculously common thing to do so I've been trying to find a bundle that already implements this sort of form type, but I haven't been able to find anything. I've found a lot of advice on how to create this functionality from scratch.

I hate re-inventing the wheel if I don't have to, so if there's something already written and tested out there, I'd definitely prefer to at least start with that.

Hopefully, this will help other people looking for the same kind of thing.

Thanks for the help!

1

There are 1 best solutions below

1
On

Take a look at this bundle: https://github.com/Sylius/SyliusAddressingBundle

Addresses management is a common task for almost every ecommerce application. This bundle, with minimal configuration, provides you sensible models and architecture for addresses, countries and provinces.

It's fully customizable - you can easily add custom fields to your address entity, or split it into several models to handle different address types. Includes a set of forms that will be sufficient for most popular actions.