承接 ventusforge/neos-nominatim 相关项目开发

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

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

ventusforge/neos-nominatim

最新稳定版本:0.1.0

Composer 安装命令:

composer require ventusforge/neos-nominatim

包简介

Nominatim Integration for Neos

README 文档

README

API connector for the Nominatim API (OpenStreetMap).

This package provides a simple HTTP client and a service to retrieve geocoordinates and address data via Nominatim search. Responses are cached by default using a Neos cache frontend.

Installation

Install with Composer:

composer require ventusforge/neos-nominatim

Configuration

You can configure the base URL and default query parameters in Configuration/Settings.yaml. Example (the package includes these defaults):

VentusForge:
  Nominatim:
    url: 'https://nominatim.openstreetmap.org/search.php'
    defaultQueryParams:
      format: 'jsonv2'
      accept-language: 'de-DE'
      countrycodes: 'de'
      addressdetails: 1

The defaultQueryParams are appended to every request sent to Nominatim (for example: language, output format, country codes, address details).

Public classes / API

  • VentusForge\Nominatim\Client

    • get(?string $street = null, ?string $city = null, ?string $postalcode = null, ?string $state = null, ?string $country = null): ?array
      • Builds a Nominatim request using individual address components (street, city, postalcode, state, country).
    • search(string $query): ?array
      • Performs a free-text search (q) against Nominatim.
  • VentusForge\Nominatim\Service\GeoLocalizationService

    • A wrapper around Client that uses Neos VariableFrontend caching and exposes the same get(...) and search(...) methods.
    • Cache keys are generated from the request parameters (MD5); cached results are returned when available.

Examples (Neos/Flow)

Inject the GeoLocalizationService into a Flow controller or service:

use VentusForge\Nominatim\Service\GeoLocalizationService;
use Neos\Flow\Annotations\Flow;

class SomeController {
    #[Flow\Inject]
    protected GeoLocalizationService $geoLocalizationService;

    public function exampleAction(): void
    {
        // Free-text search
        $result = $this->geoLocalizationService->search('Brandenburg Gate, Berlin');

        // Search by address components
        $result2 = $this->geoLocalizationService->get('Unter den Linden 6', 'Berlin', '10117', 'Berlin', 'DE');

        // $result / $result2 are arrays (or null) as returned by Nominatim
    }
}

If you prefer to call the API directly, you can use the Client class:

use VentusForge\Nominatim\Client;

// Assuming the Client is injected by Flow
$result = $this->client->search('Cologne Cathedral');

Caching

GeoLocalizationService uses a Neos VariableFrontend cache (geoLocalizationCache) to avoid repeated external requests. Adjust your cache configuration in your project if necessary.

Error handling

On HTTP errors the client throws an exception (Neos\Flow\Http\Client\Exception). Check status codes and handle potential exceptions in your application code.

License

This package is licensed under the terms described in the repository LICENSE file.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固