PHPackages                             phpfacile/geocoding - 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. phpfacile/geocoding

ActiveLibrary

phpfacile/geocoding
===================

Service mainly aimed at retrieving coordinates (latitude, longitude) of a location (address, place).

1.0.2(7y ago)023↓100%MITPHPPHP &gt;=7.0.0

Since Nov 7Pushed 7y agoCompare

[ Source](https://github.com/phpfacile/geocoding)[ Packagist](https://packagist.org/packages/phpfacile/geocoding)[ Docs](https://github.com/phpfacile/geocoding)[ RSS](/packages/phpfacile-geocoding/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (4)Used By (0)

PHPFacile! Geocoding
====================

[](#phpfacile-geocoding)

This is mainly aimed at retrieving coordinates (latitude, longitude) of a location (address, place).

It is based on geocoder-php () and tries to use the provider matching our requirements:

- The provider must allow geocoding output storage
- The provider usage must be free (for few queries)

REM: A cache is used so as to meet as far as possible usage limitation defined by the providers

Installation
------------

[](#installation)

At the root of your project type

```
composer require phpfacile/geocoding

```

Or add "phpfacile/geocoding": "^1.0" to the "require" part of your composer.json file

```
"require": {
    "phpfacile/geocoding": "^1.0"
}

```

Providers comparison
--------------------

[](#providers-comparison)

ProvidersStorage allowed?RestrictionsGeonamesYesNo more than 1 req/sGoogleMapfor 30 days maxMapBoxNoNominatimYesNo more than 1 req/sUsage
-----

[](#usage)

```
$geocodingService = new GeocodingService($cfg, $cacheDir);

$cfg = [
    'geonames' => [
        'username' => '',
    ],
    'nominatim' => [
        'rootUrl' => 'https://nominatim.openstreetmap.org',
        'userAgent' => '',
    ]
];

```

$cacheDir.'/nominatim' must exist (ex: if $cacheDir='/cache' then '/cache/nominatim' folder must exist and be writable)

Actually, in the current implementation, in any case **nominatim** is the preferred provider.

```
$locations = $this->geocodingService->getLocationsByAddress('Etretat, France');
foreach ($locations as $location) {
    var_dump($location);
}

$locations = $this->geocodingService->getPlacesByCountryAndPlaceName('France', 'Etretat');
foreach ($locations as $location) {
    var_dump($location);
}

```

Disclaimer
----------

[](#disclaimer)

Nominatim may stop its service at any moment

Troubleshooting
---------------

[](#troubleshooting)

If ever you modify the code so as to use geonames, you have to know that the following error message is silently ignored by the geonames provider ()

```
{"status":{"message":"user account not enabled to use the free webservice. Please enable it on your account page: http://www.geonames.org/manageaccount ","value":10}}

```

Todo
----

[](#todo)

- Manage localisation
- Remove unexpected (from a human point of view) results (for example, with nominatim, a query for "Paris, France" currently returns an entry with type="city" and an other entry almost identical but with type="administrative")

###  Health Score

25

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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 ~3 days

Total

3

Last Release

2685d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d6240c88e9505e69bf9ddcd371244851f480013df9c71c496c8d0fcd6de5357?d=identicon)[phpfacile](/maintainers/phpfacile)

---

Tags

geocodingplacelocationlatitudelongitudecoordinatescoords

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/phpfacile-geocoding/health.svg)

```
[![Health](https://phpackages.com/badges/phpfacile-geocoding/health.svg)](https://phpackages.com/packages/phpfacile-geocoding)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.2M21](/packages/league-geotools)[anthonymartin/geo-location

Powerful GeoCoding library: Retrieve bounding box coordinates, distances between geopoints, point in polygon, get longitude and latitude from addresses and more with GeoLocation for PHP

198916.1k4](/packages/anthonymartin-geo-location)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.2k](/packages/toin0u-geotools)[jcf/geocode

Google Geocoding API for Laravel

51159.7k](/packages/jcf-geocode)[data-values/geo

Geographical value objects, parsers and formatters

20625.5k17](/packages/data-values-geo)[1001pharmacies/geolocation-bundle

Provides an abstraction layer for geocoding services.

116.8k](/packages/1001pharmacies-geolocation-bundle)

PHPackages © 2026

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