PHPackages                             lava83/nominatim-laravel - 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. [API Development](/categories/api)
4. /
5. lava83/nominatim-laravel

ActiveLibrary[API Development](/categories/api)

lava83/nominatim-laravel
========================

Wrapper for Nominatim API to Laravel

v1.0.3(4y ago)05MITPHPPHP &gt;=7.0

Since Nov 11Pushed 4y agoCompare

[ Source](https://github.com/lava83/nominatim-laravel)[ Packagist](https://packagist.org/packages/lava83/nominatim-laravel)[ Docs](https://github.com/jbohme/php-nominatim)[ RSS](/packages/lava83-nominatim-laravel/feed)WikiDiscussions master Synced 2d ago

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

Nominatim Laravel
=================

[](#nominatim-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/593124edec252550ddf9e78bf2efd8796c2ad54066d5114b2465c6af279345d4/68747470733a2f2f706f7365722e707567782e6f72672f6a626f686d652f6e6f6d696e6174696d2d6c61726176656c2f76)](//packagist.org/packages/jbohme/nominatim-laravel)[![License](https://camo.githubusercontent.com/a92c9626bc14c3ca4f7458995b451402793027dcd30dd025221a4af01fe6f779/68747470733a2f2f706f7365722e707567782e6f72672f6a626f686d652f6e6f6d696e6174696d2d6c61726176656c2f6c6963656e7365)](//packagist.org/packages/jbohme/nominatim-laravel)

A simple interface to OSM Nominatim.

See [Nominatim documentation](http://wiki.openstreetmap.org/wiki/Nominatim) for info on the service.

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

[](#installation)

Install the package through [composer](http://getcomposer.org):

```
composer require jbohme/nominatim-laravel
```

You must publish a project configuration with:

```
php artisan vendor:publish
php artisan config:cache
```

After that the file *config/nominatim.php* will be ready.

If you are going to use a custom url, the NOMINATIM\_URL parameter must be included in the .env

Basic usage
-----------

[](#basic-usage)

Create a new instance of Nominatim.

```
use NominatimLaravel\Content\Nominatim;

$url = "http://nominatim.openstreetmap.org/";
$nominatim = new Nominatim($url);
```

Searching by query :

```
$search = $nominatim->newSearch();
$search->query('HelloWorld');

$nominatim->find($search);
```

Or break it down by address :

```
$search = $nominatim->newSearch()
            ->country('France')
            ->city('Bayonne')
            ->postalCode('64100')
            ->polygon('geojson')    //or 'kml', 'svg' and 'text'
            ->addressDetails();

$result = $nominatim->find($search);
```

Or do a reverse query :

```
$reverse = $nominatim->newReverse()
            ->latlon(43.4843941, -1.4960842);

$result = $nominatim->find($reverse);
```

Or do a lookup query :

```
$lookup = $nominatim->newLookup()
            ->format('xml')
            ->osmIds('R146656,W104393803,N240109189')
            ->nameDetails(true);

$result = $nominatim->find($lookup);
```

Or do a details query (by place\_id):

```
$details = $nominatim->newDetails()
            ->placeId(1234)
            ->polygon('geojson');

$result = $nominatim->find($details);
```

Or do a details query (by osm type and osm id):

```
$details = $nominatim->newDetails()
            ->osmType('R')
            ->osmId(1234)
            ->polygon('geojson');

$result = $nominatim->find($details);
```

By default, the output format of the request is json and the wrapper return a array of results. It can be also xml, but the wrapper return a object [SimpleXMLElement](http://php.net/manual/fr/simplexml.examples-basic.php)

How to override request header ?
--------------------------------

[](#how-to-override-request-header-)

There are two possibilities :

1. By `Nominatim` instance, for all request :

```
$nominatim = new Nominatim($url, [
    'verify' => false
]);
```

2. By `find` method, for a request :

```
$result = $nominatim->find($lookup, [
    'verify' => false
]);
```

How to customize HTTP client configuration ?
--------------------------------------------

[](#how-to-customize-http-client-configuration-)

You can inject your own HTTP client with your specific configuration. For instance, you can edit user-agent and timeout for all your requests

```
