metarete / comuni-bundle
Symfony Bundle to load and use the updated list of Italian municipalities, CAP, and ISTAT codes.
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 1
Open Issues: 0
Type:symfony-bundle
pkg:composer/metarete/comuni-bundle
Requires
- php: >=8.1
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^2|^3
- symfony/console: ^6.4|^7.3
- symfony/framework-bundle: ^6.4|^7.3
- symfony/twig-bundle: ^6.4|^7.3
Requires (Dev)
- phpstan/extension-installer: ^1.1.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-doctrine: ^1.5
- phpstan/phpstan-phpunit: ^1.0
- phpstan/phpstan-symfony: ^1.0
- phpunit/phpunit: ^10.5
README
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require metarete/comuni-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... Metarete\ComuniBundle\ComuniBundle::class => ['all' => true], ];
Load database
Go to Garda Informatica website and download archive from https://www.gardainformatica.it/database-comuni-italiani; unzip in your path.
Open a command console, enter your project directory and execute the following command to load the archive:
$ bin/console metarete:comuni:load /<path_to>/gi_comuni_cap.json
Use Service
You can call the provided ComuniService to:
- get a list of distinct province abbreviations (this->comuniService->getProvinceList())
- get a list of unique CAP (postal codes) from a given comune ($this->comuniService->getCAPListFromComune('Torino'))
- get a list of unique CAP (postal codes) from a given province ($this->comuniService->getCAPListFromProvincia('MI'))