This version of the bundle requires Symfony 2.8+.
composer require chaplean/location-bundle
Add
new Chaplean\Bundle\LocationBundle\ChapleanLocationBundle(),
Run
bin/console location:load:cities
or Add command in migration
public function postUp(Schema $schema)
{
/** @var Kernel $kernel */
$kernel = $this->container->get('kernel');
$application = new Application($kernel);
$application->setAutoExit(false);
$exitCode = $application->run(
new ArrayInput(
[
'command' => 'location:load:cities'
]
)
);
$this->abortIf($exitCode !== 0, 'see Exception above ^');
}
- Regions: ?
- Départements: https://www.insee.fr/fr/information/2114819 (cf "Liste des départements")
- Villes: https://www.data.gouv.fr/fr/datasets/base-officielle-des-codes-postaux/