PHPackages                             serendipity\_hq/component-geo-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. serendipity\_hq/component-geo-builder

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

serendipity\_hq/component-geo-builder
=====================================

Parses the exports of countries from Geonames and exports the data in machine readable formats.

0.3.0(4y ago)12721[2 issues](https://github.com/Aerendir/component-geo-builder/issues)MITPHPPHP ^7.4|^8.0CI failing

Since Feb 3Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Aerendir/component-geo-builder)[ Packagist](https://packagist.org/packages/serendipity_hq/component-geo-builder)[ Docs](https://github.com/Aerendir/component-geo-builder)[ RSS](/packages/serendipity-hq-component-geo-builder/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (13)Versions (6)Used By (0)

 [ ![](https://camo.githubusercontent.com/5041251627a7ec1bf9335a20531d818d198f5315fc6e12d88c4694c9dcfd5bc7/687474703a2f2f7777772e736572656e64697069747968712e636f6d2f6173736574732f6f70656e2d736f757263652d70726f6a656374732f4c6f676f2d536572656e64697069747948512d49636f6e2d546578742d507572706c652e706e67) ](http://www.serendipityhq.com)

Serendipity HQ Geo Builder
==========================

[](#serendipity-hq-geo-builder)

 Parses the exports of countries from Geonames and exports the data in machine readable formats.
 It downloads information of countries from \[Geonames exports\]().
 Ready to be integrated in Symfony apps.

 [![](https://camo.githubusercontent.com/0b77a5f83d13eafd633fff2ae41043e1aa0545cb64cddc24c5c1d7cddd1bd662/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736572656e6469706974795f68712f636f6d706f6e656e742d67656f2d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/Aerendir/component-geo-builder/releases) [![](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT) [![](https://camo.githubusercontent.com/7961d3e7e1dac3c8a9d0890863cff06d04b6fd2fea527a6f1528fc9108546e66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736572656e6469706974795f68712f636f6d706f6e656e742d67656f2d6275696c6465723f636f6c6f723d253233383839324246267374796c653d666c61742d737175617265266c6f676f3d706870)](https://github.com/Aerendir/component-geo-builder/releases)

 [![](https://camo.githubusercontent.com/896286af0b613482084ccd808a38e63af792f934c704f59866299cb7d1c6fa53/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d73796d666f6e792f666f726d2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://symfony.com/doc/current/forms.html)

 Supports
 [![](https://camo.githubusercontent.com/9eef96f7128a21b529c3990c650f6f2041389c5da1eaee87497ee34d30813d24/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Supports Symfony ^6.4")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Supports Symfony ^6.4") [![](https://camo.githubusercontent.com/1a9c384f3add7720776a98c04e69e303f8e0bfda2cb9192b0a98c540ce33abf1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545372e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Supports Symfony ^7.4")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Supports Symfony ^7.4") [![](https://camo.githubusercontent.com/efd0242bc44dcddb75c8d8936ab0456de2510bcb726f910e3a0ba14722ee0761/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545382e302d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Supports Symfony ^8.0")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Supports Symfony ^8.0")

 Tested on
 [![](https://camo.githubusercontent.com/9eef96f7128a21b529c3990c650f6f2041389c5da1eaee87497ee34d30813d24/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^6.4")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Tested with Symfony ^6.4") [![](https://camo.githubusercontent.com/1a9c384f3add7720776a98c04e69e303f8e0bfda2cb9192b0a98c540ce33abf1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545372e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^7.4")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Tested with Symfony ^7.4") [![](https://camo.githubusercontent.com/efd0242bc44dcddb75c8d8936ab0456de2510bcb726f910e3a0ba14722ee0761/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545382e302d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 "Tested with Symfony ^8.0")](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev "Tested with Symfony ^8.0")

Current Status
--------------

[](#current-status)

[![Coverage](https://camo.githubusercontent.com/f29656e24d6d8aabfe68badb4292bfca753017a70230499ad2fa5444d5cc1c3a/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d636f766572616765)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Maintainability Rating](https://camo.githubusercontent.com/8312a295edab239567bd06d2b0a4648587c0ca35b903cd5456f601d5afde64f9/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Quality Gate Status](https://camo.githubusercontent.com/76d2f2e0c823bbeab5755983baea8854d22e129767cd65a0927e6272eb089568/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Reliability Rating](https://camo.githubusercontent.com/ff8ef860b153547386be45cb77227626f8317feb70589c6f5bbf690328cdd299/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Security Rating](https://camo.githubusercontent.com/dd31ac000b1e35ce8e089a4cc052bb76b33912f9b158163259b78f350418adb9/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Technical Debt](https://camo.githubusercontent.com/68c4a91ed71d44db82ac4b7e2d515e1e9d20669e6083fa2aa97295a2fd75a008/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d7371616c655f696e646578)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)[![Vulnerabilities](https://camo.githubusercontent.com/314841a2c56f6cab0ea34d506d76106ed56081d960ca42dd04e40634a7ee39bd/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d416572656e6469725f636f6d706f6e656e742d67656f2d6275696c646572266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/dashboard?id=Aerendir_component-geo-builder)

[![Phan](https://github.com/Aerendir/component-geo-builder/workflows/Phan/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![PHPStan](https://github.com/Aerendir/component-geo-builder/workflows/PHPStan/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![PSalm](https://github.com/Aerendir/component-geo-builder/workflows/PSalm/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![PHPUnit](https://github.com/Aerendir/component-geo-builder/workflows/PHPunit/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![Composer](https://github.com/Aerendir/component-geo-builder/workflows/Composer/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![PHP CS Fixer](https://github.com/Aerendir/component-geo-builder/workflows/PHP%20CS%20Fixer/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)[![Rector](https://github.com/Aerendir/component-geo-builder/workflows/Rector/badge.svg)](https://github.com/Aerendir/component-geo-builder/actions?query=branch%3Adev)

Features
--------

[](#features)

- Download the exports of countries
- Build you custom lists of countries to use in your app

---

###  **Do you like this library?**
 **[LEAVE A ★](#js-repo-pjax-container)**

[](#----do-you-like-this-library----leave-a-)

 or run
 `composer global require symfony/thanks && composer thanks`
 to say thank you to all libraries you use in your current project, this included!

---

Installation and Configuration
------------------------------

[](#installation-and-configuration)

### Install Component GeoBuilder via Composer

[](#install-component-geobuilder-via-composer)

```
composer req serendipity_hq/component-geo-builder

```

This library follows the  versioning conventions.

However, until the version 1, the minor release is treated like a major one.

So it is possible a break in the public API between minor versions (0.1 &gt; 0.2 &gt; 0.3).).

The component is anyway stable and can be used in production, also if it is not very flexible.

See the issues to know more about what we have in mind to implement.

### Register the command in a Symfony application

[](#register-the-command-in-a-symfony-application)

Open the file `config/services.yaml` and add the class of the `geobuilder` command:

```
# config/services.yaml

services:
    ...
    SerendipityHQ\Component\GeoBuilder\Command\BuildCommand:
        $dumpDir: '%kernel.cache_dir%/geobuilder'

    # You also need to autowire the Guzzle CLient if you don't already have one
    GuzzleHttp\Client: ~
    ...
```

Building the list you need
--------------------------

[](#building-the-list-you-need)

To build the list you need, simply launch the command `geobuilder:build` appending the countries you want to build lists for:

```
$ bin/console geobuilder:build it de
```

By default the command uses the Hierarchy reader and will create a lot of `json` files in the `kernel.cache_dir/geobuilder` folder of your Symfony App.

You can read more about readers, saving folders and more reading the full documentation.

For the moment, let's continue putting `GeoBuilder` at work.

The next step is to create a form with the data we have just built.

Creating the form
-----------------

[](#creating-the-form)

To use the form types, you need to register them as services, so they can be properly initialized by Symfony.

To register them, open the file `config/services.yaml` and add the `HierarchyJsonType`:

```
# config/services.yaml

services:
    ...
    SerendipityHQ\Component\GeoBuilder\Reader\HierarchyJsonReader:
        $dataFolderPath: '%kernel.cache_dir%/geobuilder'
    SerendipityHQ\Component\GeoBuilder\Bridge\Symfony\Form\Type\HierarchyJsonType: ~
```

Then in your form you can add the `HierarchyJsonType`:

```
class UserZoneType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array  $options
     * @suppress PhanUnusedPublicMethodParameter
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add('geobuilder', HierarchyJsonType::class, ['country' => 'it']);
    }
}
```

About the `countries.json` file
-------------------------------

[](#about-the-countriesjson-file)

This file will contain only the countries you built with the `bin/console geobuilder:build` command.

You can get a complete list of localized countries using the `Countries::getNames()` method of the `symfony/intl` component.

But the Symfony component will return all countries in the world, also if you didn't built them.

---

###  **Do you like this library?**
 **[LEAVE A ★](#js-repo-pjax-container)**

[](#----do-you-like-this-library----leave-a--1)

 or run
 `composer global require symfony/thanks && composer thanks`
 to say thank you to all libraries you use in your current project, this included!

---

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~234 days

Total

4

Last Release

1585d ago

PHP version history (4 changes)0.1.0PHP ^7.2

0.2.0PHP ^7.3

0.0.1PHP ^7.3|^8.0

0.3.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd91a553e180dea3a2e726643704e33a1d7e4c818b65ead1516ddf2f4e23ea43?d=identicon)[Aerendir](/maintainers/Aerendir)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (670 commits)")[![kodiakhq[bot]](https://avatars.githubusercontent.com/in/29196?v=4)](https://github.com/kodiakhq[bot] "kodiakhq[bot] (591 commits)")[![Aerendir](https://avatars.githubusercontent.com/u/1968622?v=4)](https://github.com/Aerendir "Aerendir (269 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (3 commits)")[![leonardofalanga](https://avatars.githubusercontent.com/u/20907369?v=4)](https://github.com/leonardofalanga "leonardofalanga (1 commits)")

---

Tags

geonames

###  Code Quality

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/serendipity-hq-component-geo-builder/health.svg)

```
[![Health](https://phpackages.com/badges/serendipity-hq-component-geo-builder/health.svg)](https://phpackages.com/packages/serendipity-hq-component-geo-builder)
```

###  Alternatives

[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[symfony/serializer-pack

A pack for the Symfony serializer

1.1k28.2M221](/packages/symfony-serializer-pack)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
