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

1.0.0(yesterday)03↑2900%MITPHPPHP ^8.3

Since Jun 18Pushed yesterdayCompare

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

READMEChangelog (1)Dependencies (9)Versions (2)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 Google Maps API 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)

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
```

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 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

1d ago

### 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 (1 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

3325.1M337](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

9782.1M157](/packages/laravel-ai)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M152](/packages/spatie-laravel-health)[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.

45344.0k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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