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

1.0.8 2025-11-28 15:33 UTC

This package is auto-updated.

Last update: 2025-12-28 16:28:35 UTC


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'))

Link

Garda Informatica

Credits

Metarete s.r.l.