PHPackages                             nr/fieldtypegeocoder - 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. nr/fieldtypegeocoder

ActivePw-module[Utility &amp; Helpers](/categories/utility)

nr/fieldtypegeocoder
====================

Collect and store Geocode information from several providers

1.0.6(7mo ago)4492[1 issues](https://github.com/neuerituale/FieldtypeGeocoder/issues)MITPHP

Since Jun 9Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/neuerituale/FieldtypeGeocoder)[ Packagist](https://packagist.org/packages/nr/fieldtypegeocoder)[ RSS](/packages/nr-fieldtypegeocoder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (9)Used By (0)

FieldtypeGeocoder
=================

[](#fieldtypegeocoder)

What it does
------------

[](#what-it-does)

Retrieve, collect and store geolocation data from external geocoding services. Under the hood, the module uses the great PHP Library [geocoder-php](https://github.com/geocoder-php/Geocoder) by William Durand and Tobias Nyholm and adds some processwire magic. Thanks to Ryan (FieldtypeMapMarker) and mats (FieldtypeLeafletMapMarker), from which we drew a lot of inspiration developing this module!

Features
--------

[](#features)

- Fulltext search in formatted Address
- Proximity search
- Search in geojson
- Easily hookable geocoding providers ([supported providers](https://geocoder-php.org/docs/#providers))
- Normalized geocoder object from geocoder-php
- Supports The [GraphQL-Module](https://processwire.com/modules/process-graph-ql/) by *dadish*

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

[](#installation)

1. Copy the files for this module to /site/modules/FieldtypeGeocoder/
2. Execute the following command in the /site/modules/FieldtypeGeocoder/ directory. ```
    composer install

    # if you get an php version error use
    /usr/bin/php7.4 /usr/local/bin/composer update
    ```
3. In processwire admin: Modules &gt; Refresh and install Fieldtype &gt; Geocoder.
4. Insert the api-key for your geocoding provider. The default provider is [OpenCage](https://opencagedata.com/). OpenCage uses various other geocoding services. You can change the provider with a processwire hook. [read more](#hook)
5. Create a new field of type Geocoder, and name it whatever you like. In our examples we named it simply "geocoder".
6. Add the field to a template and start geocoding!

- For GraphQL install the modul `GraphQLFieldtypeGeocoder`

Install via composer
--------------------

[](#install-via-composer)

1. Execute the following command in your website root directory. ```
    composer require nr/fieldtypegeocoder
    ```

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- PHP Extensions: json, curl, intl

Module Configuration
--------------------

[](#module-configuration)

`Modules` &gt; `Configure` &gt; `FieldtypeGeocoder`

Insert you api key here. The default

[![Configuration](https://user-images.githubusercontent.com/11630948/121345381-13514c00-c925-11eb-85f0-f4056413f645.png)](https://user-images.githubusercontent.com/11630948/121345381-13514c00-c925-11eb-85f0-f4056413f645.png)

Field Configuration
-------------------

[](#field-configuration)

`Fields` &gt; `your_field` &gt; `input`

Each field can have a default map center

[![Configuration](https://user-images.githubusercontent.com/11630948/121345392-151b0f80-c925-11eb-90d7-c408348888a8.png)](https://user-images.githubusercontent.com/11630948/121345392-151b0f80-c925-11eb-90d7-c408348888a8.png)

API Reference
-------------

[](#api-reference)

#### Seach in input

[](#seach-in-input)

```
// Fulltextsearch
$pages->find('geocoder*=Berl');
```

#### Search in formatted address

[](#search-in-formatted-address)

```
// Fulltextsearch
$pages->find('geocoder.formatted*=Berlin');
```

#### Search in properties

[](#search-in-properties)

```
// Simplesearch
$pages->find('geocoder.properties.timezone=Europe/Berlin');
$pages->find('geocoder.properties.locality=Berlin');
$pages->find('geocoder.properties.lat>10');
```

#### Search and order by proximity

[](#search-and-order-by-proximity)

```
$pages->find('geocoder.proximity=52.473758|13.402580, limit=3');
```

#### Search by status

[](#search-by-status)

```
/**
 * @see Geocoder::statusOn
 * @see Geocoder::statusSingleResult
 * @see Geocoder::statusMultipleResults
 */
$pages->find('geocoder.status=3'); // Status "On" and "SingleResult"
$pages->find('geocoder.status&2|4'); // Status "SingleResult" or "MultipleResults"
```

The Geocoder Object
-------------------

[](#the-geocoder-object)

```
ProcessWire\Geocoder Object
(
    [data] => Array
        (
            [status] => 5
            [formatted] => Berlin, Deutschland
            [query] => Berlin
            [geodata] => Array
                (
                    [type] => Feature
                    [bounds] => Array
                        (
                            [east] => 13,5488599
                            [west] => 13,2288599
                            [north] => 52,6770365
                            [south] => 52,3570365
                        )

                    [geometry] => Array
                        (
                            [type] => Point
                            [coordinates] => Array
                                (
                                    [0] => 13,3888599
                                    [1] => 52,5170365
                                )

                        )

                    [properties] => Array
                        (
                            [country] => Deutschland
                            [locality] => Berlin
                            [timezone] => Europe/Berlin
                            [postalCode] => 10117
                            [providedBy] => opencage
                            [adminLevels] => Array
                                (
                                    [1] => Array
                                        (
                                            [code] => BE
                                            [name] => Berlin
                                            [level] => 1
                                        )

                                )

                            [countryCode] => DE
                        )

                )

            [lat] => 52,517036
            [lng] => 13,38886
            [provider] => opencage
        )

)
```

Hooks / Change provider
-------------------------------------------------------

[](#hooks--change-provider)

You can hook some methods to change or override the geocoding provider. [Here](https://github.com/geocoder-php/Geocoder#providers) you can find a full list of supported providers.

1. Download, unzip provider package.
2. Move the files in your folder structure (`Provider.php` and `ProviderAddress.php`)\*.
3. Load all files with `require_once()` command.

\*Replace "Provider" with the provider name e.g. Google or Mapbox etc.

### Example 1: Google Maps Provider Package

[](#example-1-google-maps-provider-package)

- [Geocoding Api](https://developers.google.com/maps/documentation/geocoding/overview) Documentation and examples
- [Maps Platform](https://cloud.google.com/maps-platform/) Configure your api-key

```
/** @global Wire $wire */
$wire->addHookBefore('FieldtypeGeocoder::getProvider', function(HookEvent $event) {

	require_once (/*NoCompile*/__DIR__ .'/providers/GoogleMaps.php');
	require_once (/*NoCompile*/__DIR__ .'/providers/GoogleAddress.php');

	$fieldtype = $event->object;
	$apiKey = $fieldtype->apiKey; // or insert the key direct
	$adapter = $event->argumentsByName('adapter');

	$event->return = new \Geocoder\Provider\GoogleMaps\GoogleMaps($adapter, null, $apiKey);
	$event->replace = true;
});
```

### Example 2: Mapbox Search Provider Package

[](#example-2-mapbox-search-provider-package)

- [Geocoding Api](https://docs.mapbox.com/api/search/geocoding/) Documentation and examples
- [Playground](https://docs.mapbox.com/search-playground/) Playground (👍)
- [Access Tokens](https://account.mapbox.com/access-tokens/) Create and manage your keys

```
use Geocoder\Provider\Mapbox\Mapbox;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;

/** @global Wire $wire */

$wire->addHookBefore('FieldtypeGeocoder::getProvider', function(HookEvent $event) {

	require_once (/*NoCompile*/__DIR__ .'/providers/Mapbox.php');
	require_once (/*NoCompile*/__DIR__ .'/providers/MapboxAddress.php');

	$fieldtype = $event->object;
	$adapter = $event->argumentsByName('adapter');

	$event->return = new Mapbox($adapter, $fieldtype->apiKey, null);
	$event->replace = true;
});

/**
 * Manipulate the query
 * For better results, add all mapbox types to the query
 */
$wire->addHookAfter('FieldtypeGeocoder::filterQuery', function(HookEvent $event) {

	/** @var GeocodeQuery|ReverseQuery $query */
	$query = $event->argumentsByName('query');
	$query = $query->withData('location_type', Mapbox::TYPES);
	$event->return = $query;
});
```

Todos
-----

[](#todos)

- Update provider-string if you use the autocomplete function from the inputfield or move the marker.
- Refactor the inputfield javascript for other maps or mapstyles
- Add warnings if a vendor package is not found!

Feedback
--------

[](#feedback)

If you have any feedback, please reach out to us at  or create an issue in the github projekt.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance58

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% 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 ~262 days

Recently: every ~329 days

Total

7

Last Release

229d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61a0639a232837322b461271ef1775f769c3ff4e289141c9ee5bdcebc8f29835?d=identicon)[nr](/maintainers/nr)

---

Top Contributors

[![julianwinkel](https://avatars.githubusercontent.com/u/11630948?v=4)](https://github.com/julianwinkel "julianwinkel (27 commits)")[![bi11n3r](https://avatars.githubusercontent.com/u/31960287?v=4)](https://github.com/bi11n3r "bi11n3r (1 commits)")

---

Tags

geocoderprocesswiremodule

### Embed Badge

![Health badge](/badges/nr-fieldtypegeocoder/health.svg)

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

###  Alternatives

[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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