PHPackages                             maarheeze/geocode-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. maarheeze/geocode-laravel

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

maarheeze/geocode-laravel
=========================

laravel integration for maarheeze/geocode

2.0.0(2w ago)017↓50%MITPHPPHP ^8.3

Since Jun 18Pushed 2w agoCompare

[ Source](https://github.com/maarheeze/geocode-laravel)[ Packagist](https://packagist.org/packages/maarheeze/geocode-laravel)[ RSS](/packages/maarheeze-geocode-laravel/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (2)Dependencies (18)Versions (3)Used By (0)

maarheeze/geocode-laravel
=========================

[](#maarheezegeocode-laravel)

**Laravel integration for [maarheeze/geocode](https://github.com/maarheeze/geocode).**

This package wires the tiny, typed [geocode](https://github.com/maarheeze/geocode) library into Laravel: it binds the `Geocode` service in the container from config, ships a facade, and an optional database cache so repeated lookups don't hit the geocoding provider again.

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

[](#installation)

```
composer require maarheeze/geocode-laravel
```

The package auto-registers via Laravel's package discovery, but make sure you run the migrations if you enable caching.

Configuration
-------------

[](#configuration)

Choose which driver resolves addresses. Defaults to `google`:

```
GEOCODE_DRIVER=google
```

Available drivers:

- `google` — uses the Google Maps API and requires an API key (see below).
- `pdok` — uses the Dutch [PDOK Locatieserver](https://www.pdok.nl/) and needs no API key.

When using the `google` driver, set your Google Maps API key:

```
GEOCODE_GOOGLE_MAPS_API_KEY=your-key
```

And you might want to override these default settings:

```
GEOCODE_CACHE_ENABLED=true
GEOCODE_CACHE_TABLE=geocode_cache
```

### Publishing the config

[](#publishing-the-config)

To customize settings beyond the environment variables, publish the config file to `config/geocode.php`:

```
php artisan vendor:publish --tag=geocode-config
```

Usage
-----

[](#usage)

The `Maarheeze\Geocode\Geocode` contract is bound in the container, so inject it anywhere:

```
use Maarheeze\Geocode\Geocode;

class StoreController
{
    public function __construct(
        private readonly Geocode $geocode,
    ) {
    }

    public function show(): void
    {
        $coordinates = $this->geocode->getCoordinatesForAddress('Stationsstraat 1, Maarheeze');

        if ($coordinates !== null) {
            // $coordinates->latitude, $coordinates->longitude
        }
    }
}
```

Or via the facade:

```
use Maarheeze\Geocode\Laravel\Facades\Geocode;

$coordinates = Geocode::getCoordinatesForAddress('Stationsstraat 1, Maarheeze');
```

### Distance

[](#distance)

`Coordinates` can measure the great-circle distance to another `Coordinates`, returning a `Distance` you can read in meters or kilometers:

```
use Maarheeze\Geocode\Laravel\Facades\Geocode;

$eindhoven = Geocode::getCoordinatesForAddress('Eindhoven');
$maarheeze = Geocode::getCoordinatesForAddress('Maarheeze');

if ($eindhoven === null || $maarheeze === null) {
    // One of the addresses could not be resolved.
    return;
}

echo $eindhoven->distanceTo($maarheeze)->asKilometers(); // e.g. 18.7
```

### Caching

[](#caching)

When `geocode.cache.enabled` is `true`, the bound service is wrapped in a `CachingGeocode` decorator. Every resolved address is stored in the cache table (keyed by the address string) and subsequent lookups of the same address are served from the database without calling the API. Addresses that cannot be resolved are not cached. Caching is transparent — consumers keep using the same `Geocode` contract.

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

20d ago

Major Versions

1.0.0 → 2.0.02026-07-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/734972e64c460b2142b0b04b4f40aa30077c5dd1915411b486ec72efcae3c3bf?d=identicon)[wietsewarendorff](/maintainers/wietsewarendorff)

---

Top Contributors

[![wietsewarendorff](https://avatars.githubusercontent.com/u/313525?v=4)](https://github.com/wietsewarendorff "wietsewarendorff (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maarheeze-geocode-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/maarheeze-geocode-laravel/health.svg)](https://phpackages.com/packages/maarheeze-geocode-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.4M352](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M275](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20433.0M1.7k](/packages/illuminate-queue)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[illuminate/pagination

The Illuminate Pagination package.

12234.6M1.1k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9350.2M302](/packages/illuminate-pipeline)

PHPackages © 2026

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