承接 jbohme/nominatim-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jbohme/nominatim-laravel

最新稳定版本:v1.0.3

Composer 安装命令:

composer require jbohme/nominatim-laravel

包简介

Wrapper for Nominatim API to Laravel

README 文档

README

Latest Stable Version License

A simple interface to OSM Nominatim.

See Nominatim documentation for info on the service.

Installation

Install the package through composer:

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

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

How to override request header ?

There are two possibilities :

  1. By Nominatim instance, for all request :
$nominatim = new Nominatim($url, [ 'verify' => false ]);
  1. By find method, for a request :
$result = $nominatim->find($lookup, [ 'verify' => false ]);

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

<?php use maxh\Nominatim\Nominatim; use GuzzleHttp\Client; $url = "http://nominatim.openstreetmap.org/"; $defaultHeader = [ 'verify' => false, 'headers', array('User-Agent' => 'api_client') ]; $client = new Client([ 'base_uri' => $url, 'timeout' => 30, 'connection_timeout' => 5, ]); $nominatim = new Nominatim($url, $defaultHeader, $client);

Note

This projet was inpired by the maxhelias/php-nominatim. The code has been adapted to the Laravel standard for future implementations.

Recall Usage Policy Nominatim

If you use the service : http://nominatim.openstreetmap.org/, please see Nominatim usage policy.

统计信息

  • 总下载量: 37.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固