PHPackages                             lase-peco/geocoder - 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. lase-peco/geocoder

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

lase-peco/geocoder
==================

A small geocoder library for laravel.

1.1(1y ago)280MITPHPPHP &gt;=8.0

Since Oct 13Pushed 1y agoCompare

[ Source](https://github.com/lase-peco/geocoder)[ Packagist](https://packagist.org/packages/lase-peco/geocoder)[ RSS](/packages/lase-peco-geocoder/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

geocoder
========

[](#geocoder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8aa35edf7508ded8edc13a529a4324f6fb6f521f76de37417bc9d8000d3b9fe3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6173652d7065636f2f67656f636f6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lase-peco/geocoder)[![Total Downloads](https://camo.githubusercontent.com/fc4b373141aae9aa9a8352fd056d68587f79c3a217f6e5bb5fbfee57ec4b90d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6173652d7065636f2f67656f636f6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lase-peco/geocoder)

A small geocoder library for laravel.

Notes
-----

[](#notes)

This whole package is depending on the API [nominatim.org](https://nominatim.org/release-docs/develop/).

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

[](#installation)

You can install the package via composer:

```
composer require lase-peco/gecoder
```

Then publish the config file `geocoder.php` with the following command:

```
php artisan vendor:publish --provider="LasePeCo\Geocoder\ServiceProvider" --tag="config"
```

The API from nominatim has a request limit of an absolute maximum of 1 request per second. this is defined in th config file, which you can change at your on risk. you can read about it under [operations.osmfoundation.org/policies](https://operations.osmfoundation.org/policies/nominatim/).

Also in the config file you can define how long should this library cache the results of your searches. The default is one Month.

Usage
-----

[](#usage)

With the help of the facade `Geocoder` you can call two main functions `search` and `reverse`.

### The search function

[](#the-search-function)

You can call the `search` function on the `Geocoder` facade and provide it directly with the `(string)` address.

this kind of search 'Free-form query' process the provided (string) address first left-to-right and then right-to-left if that fails. So you may search for `pilkington avenue, birmingham` as well as for `birmingham, pilkington avenue`.

Commas are optional, but improve performance by reducing the complexity of the search.

You can also provide the search function with a part of the address,but the result might not be accurate.

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::search('Rudolf-Diesel-Str. 115, 46485 Wesel')
```

It will return a default json response with the results for the provided address which is accessible as a collection:

```
Illuminate\Support\Collection {
  items:[
    0 => {
      "place_id": 317291459
      "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
      "osm_type": "way"
      "osm_id": 915146453
      "boundingbox": [
            0 => "51.6674904"
            1 => "51.6679331"
            2 => "6.6641183"
            3 => "6.665015"
           ]
      "lat": "51.667710650000004"
      "lon": "6.664615146813532"
      "display_name": "Cubes Wesel, 115, Rudolf-Diesel-Straße, Obrighoven, Obrighoven-Lackhausen, Wesel, Kreis Wesel, Nordrhein-Westfalen, 46485, Deutschland"
      "class": "building"
      "type": "commercial"
      "importance": 0.631
    }
  ]
}
```

Furthermore, you can provide the `search` function with a new object of the `StructuredAddress` class, through which you can construct the address:

**This method is preferred to enable the API to find the address better and faster.**

```
use LasePeCo\Geocoder\Facades\Geocoder;
use LasePeCo\Geocoder\StructuredAddress;

$address = new StructuredAddress();

$address->street('Rudolf-Diesel-Str. 115')
        ->city('Wesel')
        ->postalcode('46485')
        ->state('Nordrhein-Westfalen')
        ->country('Deutschland');

Geocoder::search($address);
```

---

### The reverse function

[](#the-reverse-function)

With the `reverse` function you can reverse search the address with the help of its latitude and longitude:

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::reverse('lat', 'lon')
```

It will return the same default json response which is accessible as a collection.

---

\##Further functions

All the following functions are able to be used with the `search` and `reverse` functions.

### withAddressDetails()

[](#withaddressdetails)

If you call the `withAddressDetails()` on the `Geocoder` facade you will get the address detailed:

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::withAddressDetails()->search('Rudolf-Diesel-Str. 115, 46485 Wesel')

//retrun

"address": {
   "building": "Cubes Wesel"
   "house_number": "115"
   "road": "Rudolf-Diesel-Straße"
   "suburb": "Obrighoven"
   "town": "Wesel"
   "county": "Kreis Wesel"
   "state": "Nordrhein-Westfalen"
   "postcode": "46485"
   "country": "Deutschland"
   "country_code": "de"
  }
```

### withExtraTags()

[](#withextratags)

If you call the `withExtraTags()` on the `Geocoder` facade you will get extra tag for the address:

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::withExtraTags()->search('Rudolf-Diesel-Str. 115, 46485 Wesel')

//retrun

"extratags": {
  "building:levels": "2"
}
```

### language()

[](#language)

Call the function `language()` on the facade `Geocoder` with the language as a parameter to translate the result of the search.

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::withAddressDetails()->withExtraTags()->language('en')->search('Rudolf-Diesel-Str. 115, 46485 Wesel');

//return

Illuminate\Support\Collection {
  #items: [
    0 => {
      "place_id": 317291459
      "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
      "osm_type": "way"
      "osm_id": 915146453
      "boundingbox":[
        0 => "51.6674904"
        1 => "51.6679331"
        2 => "6.6641183"
        3 => "6.665015"
      ]
      "lat": "51.667710650000004"
      "lon": "6.664615146813532"
      "display_name": "Cubes Wesel, 115, Rudolf-Diesel-Straße, Obrighoven, Obrighoven-Lackhausen, Wesel, Kreis Wesel, North Rhine-Westphalia, 46485, Germany"
      "class": "building"
      "type": "commercial"
      "importance": 0.631
      "address": {#1853 ▼
        "building": "Cubes Wesel"
        "house_number": "115"
        "road": "Rudolf-Diesel-Straße"
        "suburb": "Obrighoven"
        "town": "Wesel"
        "county": "Kreis Wesel"
        "state": "North Rhine-Westphalia"
        "postcode": "46485"
        "country": "Germany"
        "country_code": "de"
      }
      "extratags": {#1861 ▼
        "building:levels": "2"
      }
    }
  ]
}
```

### withNameDetails()

[](#withnamedetails)

Call the function `withNameDetails()` on the facade `Geocoder` with the language as a parameter to translate the result of the search.

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::withNameDetails()->search('Rudolf-Diesel-Str. 115, 46485 Wesel');

//return

"namedetails": {
  "name": "Cubes Wesel"
}
```

### format()

[](#format)

This package supports the following formats: `xml`,`json`,`jsonv2`,`geojson`,`geocodejson`.

Call the function `format()` on the facade `Geocoder` with the desired format as a parameter.

For the formats `xml`and `json` there is two functions that you can call `xml()` and `json()`.

```
use LasePeCo\Geocoder\Facades\Geocoder;

Geocoder::format('xml')->search('Rudolf-Diesel-Str. 115, 46485 Wesel')
//or
Geocoder::xml()->search('Rudolf-Diesel-Str. 115, 46485 Wesel')

//return

```

### Testing

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ahmed Dabak](https://github.com/lase-peco)
- [Abdulsalam Emesh](https://github.com/lase-peco)
- [All Contributors](CONTRIBUTING.md)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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

Total

5

Last Release

566d ago

Major Versions

0.9 → 1.02022-02-28

PHP version history (2 changes)0.9PHP ^8.0

1.1PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11370582?v=4)[Ahmed Dabak](/maintainers/ahmeddabak)[@ahmeddabak](https://github.com/ahmeddabak)

---

Top Contributors

[![ahmeddabak](https://avatars.githubusercontent.com/u/11370582?v=4)](https://github.com/ahmeddabak "ahmeddabak (42 commits)")

---

Tags

addressgeogeocodinglaravellibrary

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/lase-peco-geocoder/health.svg)

```
[![Health](https://phpackages.com/badges/lase-peco-geocoder/health.svg)](https://phpackages.com/packages/lase-peco-geocoder)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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