PHPackages                             perfacilis/geocoder - 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. perfacilis/geocoder

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

perfacilis/geocoder
===================

Simple Geocoder with Cache using Google Maps API

0.3(2mo ago)0383MITPHP

Since Jun 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/perfacilis/geocoder)[ Packagist](https://packagist.org/packages/perfacilis/geocoder)[ RSS](/packages/perfacilis-geocoder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (10)Used By (0)

Simple Geocoder with Cache using Google Maps API
================================================

[](#simple-geocoder-with-cache-using-google-maps-api)

Uses PSR SimpleCache interface to allow for query results to be stored.

This is a standalone library, no Laravel or other Frameworks, to keep it as simple and lightweight as possible, but rest assured, it'll work with Laravel just fine :)

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

[](#installation)

```
composer require perfacilis/geocoder
```

Usage
-----

[](#usage)

### Get a Google Maps API key

[](#get-a-google-maps-api-key)

See:

Create a new API key, ensure to:

1. restrict it to your IP(s) only;
2. restrict it to use the Geocoding API only.

If you're using the Google Maps JS API you'll probably have to create a different key because that key should be restricted to HTTP referers (web sites).

### Simple Example

[](#simple-example)

```
$api_key = '123foo456bar';

$geocoder = new Perfacilis\Geocoder\Geocoder($api_key);
$result = $geocoder->geocode('Street 12, 1234AB, Residence, Country');

$lat = $result->getLat();
$lng = $result->getLng();
```

Enabling Cache
--------------

[](#enabling-cache)

Since Google's Geocoding API is on a Pay-Per-Use basis, it's recommended to implement your own Cacher using PSR's SimpleCache interface:

```
$api_key = '123foo456bar';
$cacher = new GeocoderCache();

$geocoder = new Perfacilis\Geocoder\Geocoder($api_key);
$geocoder->setCacheInterface($cacher);

$result = $geocoder->query(...);
```

You can manually create a cacher to store results in a simple database:

```
class GeocoderCache implements Psr\SimpleCache\CacheInterface
{
   ...
}
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance49

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

5

Last Release

63d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45437baf92765381fecf1a20de59251767356db6289389ba63dc3291ac7c926a?d=identicon)[royarisse](/maintainers/royarisse)

---

Top Contributors

[![royarisse](https://avatars.githubusercontent.com/u/11944222?v=4)](https://github.com/royarisse "royarisse (8 commits)")

### Embed Badge

![Health badge](/badges/perfacilis-geocoder/health.svg)

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

###  Alternatives

[illuminate/contracts

The Illuminate Contracts package.

705122.9M10.1k](/packages/illuminate-contracts)[phiki/phiki

Syntax highlighting using TextMate grammars in PHP.

3573.0M23](/packages/phiki-phiki)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.5M9](/packages/gehrisandro-tailwind-merge-php)[bakame/laravel-domain-parser

Laravel package to integrate PHP Domain parser.

26534.8k4](/packages/bakame-laravel-domain-parser)

PHPackages © 2026

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