PHPackages                             francoisvaillant/geolocator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. francoisvaillant/geolocator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

francoisvaillant/geolocator
===========================

Geolocator is a simple tool to geolocate address or reverse. It is also able to determinate altitude.

1.1(4y ago)027MITPHPPHP &gt;=7.4.0

Since Jan 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/frvaillant/Geolocator)[ Packagist](https://packagist.org/packages/francoisvaillant/geolocator)[ RSS](/packages/francoisvaillant-geolocator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

Geolocator
==========

[](#geolocator)

Geolocator is a simple tool to geolocate address or reverse. It is also capable to determinate altitude.

It uses 3 Api :

-
-
-

Setup
-----

[](#setup)

```
composer require francoisvaillant/geolocator

```

namespaces
----------

[](#namespaces)

- \\Francoisvaillant\\Geolocator\\
- \\Francoisvaillant\\Geolocator\\Providers

All begin by a place
--------------------

[](#all-begin-by-a-place)

```
$place = new Place()
```

By default, we uses french Government "adresses Api". If you prefer (especially out of France), you can use NominatimApi by setting it as provider for your Place :

```
$place = new Place(NominatimProvider::class)
```

Get Coordinates from address
----------------------------

[](#get-coordinates-from-address)

In order to geolocate an address, your have first to set it and setting City or ZipCode. City is often not enough. It's highly recommended to set city and zipCode before using geolocation.

```
$place
    ->setAddress('your address');
    ->setCity('city name');
    ->setZipCode(00000);
    ->geolocate();

$latitude  = $place->getLatitude();  // NULL if geolocation failed
$longitude = $place->getLongitude(); // NULL if geolocation failed
```

Get address from coordinates
----------------------------

[](#get-address-from-coordinates)

```
$place
    ->setLatitude(45.548);
    ->setLongitude(1.897);
    ->reverse();

$address = $place->getAddress(); // NULL if reverse failed
$zipCode = $place->getZipCode(); // NULL if reverse failed
$city    = $place->getCity();    // NULL if reverse failed
```

Get altitude from coordinates
-----------------------------

[](#get-altitude-from-coordinates)

uses OpenTopoData APi. See  for details and restrictions

```
$place
    ->setLatitude(45.548);
    ->setLongitude(1.897);
    ->findAltitude()
    ->getAltitude(); // NULL if failed
```

If you host your own instance of OpenTopoData Api, please change AltitudeProvider :

```
    $altitudeProvider = new AltitudeProvider('http://localhost:5000/v1/srtm30m?locations=%s,%s'); // note that first %s is for latitude, second one is for longitude
    $place->setAltitudeProvider($altitudeProvider);
```

What you can get :
------------------

[](#what-you-can-get-)

Once you totally hydrated your Place whith -&gt;geolocate() or -&gt;reverse() (altitude is a bit different), you'll be able to get all the above informations (However depends on the provider) :

```
- city
- zipCode
- address
- inseeCode
- department code
- departement name
- region name
- latitude and longitude (degrees)
- latitude and longitude (lambert93)

```

Note that the geolocate() and reverse() return true or false if succeed or not. So you can use :

```
    if($place->geolocate()) {
        // ...
    }

    if($place->reverse()) {
        // ...
    }
```

If you want to check all the response from Api after geolocate(), reverse() or findAltitude() :

```
$place
    //...
    ->geolocate();
$place->getProvider()->getResponseData();

$place
    //...
    ->reverse();
$place->getProvider()->getResponseData();

$place
    //...
    ->findAltitude();
$place->getAltitudeProvider()->getResponseData();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Total

2

Last Release

1528d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33039316?v=4)[François VAILLANT](/maintainers/frvaillant)[@frvaillant](https://github.com/frvaillant)

---

Top Contributors

[![frvaillant](https://avatars.githubusercontent.com/u/33039316?v=4)](https://github.com/frvaillant "frvaillant (22 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/francoisvaillant-geolocator/health.svg)

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

###  Alternatives

[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[pixelopen/cloudflare-turnstile-bundle

A simple package to help integrate Cloudflare Turnstile on Symfony.

31205.8k3](/packages/pixelopen-cloudflare-turnstile-bundle)

PHPackages © 2026

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