PHPackages                             jcf/geocode - 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. [API Development](/categories/api)
4. /
5. jcf/geocode

ActiveLibrary[API Development](/categories/api)

jcf/geocode
===========

Google Geocoding API for Laravel

1.4.0(8y ago)48160.5k↑15.7%23[2 issues](https://github.com/jotafurtado/geocode/issues)[1 PRs](https://github.com/jotafurtado/geocode/pulls)MITPHPPHP &gt;=5.4.0

Since May 22Pushed 7y ago3 watchersCompare

[ Source](https://github.com/jotafurtado/geocode)[ Packagist](https://packagist.org/packages/jcf/geocode)[ RSS](/packages/jcf-geocode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Google Geocoding API for Laravel
================================

[](#google-geocoding-api-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/3a5ee2caf526de15f090a758986566a08b20e2f18fe612cf7a7b5cd2725a8da1/68747470733a2f2f706f7365722e707567782e6f72672f6a63662f67656f636f64652f762f737461626c652e737667)](https://packagist.org/packages/jcf/geocode) [![Total Downloads](https://camo.githubusercontent.com/d9c4a6edb9e55aecaae4ba08a7cc6f6dd7cfe43f57ba74a468ec6be8b1c67416/68747470733a2f2f706f7365722e707567782e6f72672f6a63662f67656f636f64652f646f776e6c6f6164732e737667)](https://packagist.org/packages/jcf/geocode) [![License](https://camo.githubusercontent.com/1eddcdac2ec771844f04f96c95b2e9db58eb07f9917991175ac995786a0b4aa2/68747470733a2f2f706f7365722e707567782e6f72672f6a63662f67656f636f64652f6c6963656e73652e737667)](https://packagist.org/packages/jcf/geocode)

A simple [Laravel](http://laravel.com/) service provider for Google Geocoding API.

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

[](#installation)

This package can be installed via [Composer](http://getcomposer.org).

Run composer require command.

```
composer require "jcf/geocode":"~1.3"
```

### Laravel 5.5

[](#laravel-55)

Both the service provider and alias will be automatically installed by Laravel 5.5 package discovery. If you don't use auto discovery, follow the instructions for Laravel 5.0-5.4 below:

### Laravel 5.0-5.4

[](#laravel-50-54)

After updating composer, add the service provider to the providers array in app/config/app.php

```
Jcf\Geocode\GeocodeServiceProvider::class,
```

Add then alias Geocode adding its facade to the aliases array in the same file :

```
'Geocode' => Jcf\Geocode\Facades\Geocode::class,
```

### Laravel 4

[](#laravel-4)

After updating composer, add the service provider to the providers array in app/config/app.php

```
'Jcf\Geocode\GeocodeServiceProvider',
```

Add then alias Geocode adding its facade to the aliases array in the same file :

```
'Geocode' => 'Jcf\Geocode\Facades\Geocode'
```

### Lumen 5

[](#lumen-5)

After updating composer, register the service provider in bootstrap/app.php

```
$app->register(Jcf\Geocode\GeocodeServiceProvider::class);
```

Since facade are not enabled by default on Lumen, don't forget to add this.

```
use Jcf\Geocode\Geocode;
```

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

[](#configuration)

Add the following line to the .env file:

```
GEOCODE_GOOGLE_APIKEY=
```

You can optionally set the response language.

```
GEOCODE_GOOGLE_LANGUAGE=en # pt-BR, es, de, it, fr, en-GB
```

[Supported Languages](https://developers.google.com/maps/faq?hl=en#languagesupport) for Google Maps Geocoding API.

Usage
-----

[](#usage)

You can find data from addresses:

```
$response = Geocode::make()->address('1 Infinite Loop');

if ($response) {
	echo $response->latitude();
	echo $response->longitude();
	echo $response->formattedAddress();
	echo $response->locationType();
}

// Output
// 37.331741
// -122.0303329
// 1 Infinite Loop, Cupertino, CA 95014, USA
// ROOFTOP
```

Or from latitude/longitude:

```
$response = Geocode::make()->latLng(40.7637931,-73.9722014);
if ($response) {
	echo $response->latitude();
	echo $response->longitude();
	echo $response->formattedAddress();
	echo $response->locationType();
}

// Output
// 40.7637931
// -73.9722014
// 767 5th Avenue, New York, NY 10153, USA
// ROOFTOP
```

If you need other data rather than formatted address, latitude, longitude or location type, you can use the `raw()` method:

```
$response = Geocode::make()->latLng(40.7637931,-73.9722014);
if ($response) {
	echo $response->raw()->address_components[8]['types'][0];
	echo $response->raw()->address_components[8]['long_name'];
}

// Output
// postal_code
// 10153
```

That's it. Pull requests are welcome.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 56% 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 ~222 days

Recently: every ~114 days

Total

7

Last Release

3046d ago

Major Versions

0.0.1 → 1.0.02014-07-19

PHP version history (2 changes)0.0.1PHP &gt;=5.3.0

1.0.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/780f9f462d79aec5189728479735d339b890a5db9d389f0b4ec6bb0627fd3ab7?d=identicon)[jotafurtado](/maintainers/jotafurtado)

---

Top Contributors

[![jotafurtado](https://avatars.githubusercontent.com/u/748350?v=4)](https://github.com/jotafurtado "jotafurtado (28 commits)")[![jpmurray](https://avatars.githubusercontent.com/u/1550428?v=4)](https://github.com/jpmurray "jpmurray (8 commits)")[![djereg](https://avatars.githubusercontent.com/u/6384768?v=4)](https://github.com/djereg "djereg (6 commits)")[![DougSisk](https://avatars.githubusercontent.com/u/70512?v=4)](https://github.com/DougSisk "DougSisk (2 commits)")[![brino](https://avatars.githubusercontent.com/u/986822?v=4)](https://github.com/brino "brino (2 commits)")[![thsteinmetz](https://avatars.githubusercontent.com/u/4640652?v=4)](https://github.com/thsteinmetz "thsteinmetz (1 commits)")[![dave-miller](https://avatars.githubusercontent.com/u/1550539?v=4)](https://github.com/dave-miller "dave-miller (1 commits)")[![grumpysi](https://avatars.githubusercontent.com/u/6876914?v=4)](https://github.com/grumpysi "grumpysi (1 commits)")[![Niellles](https://avatars.githubusercontent.com/u/10075507?v=4)](https://github.com/Niellles "Niellles (1 commits)")

---

Tags

apilaravelgeocodingaddressgooglelatitudelongitudegeocode

### Embed Badge

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

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

###  Alternatives

[jackmartin/laravel-yandex-geocode

Simply service laravel Yandex Geocoding

1016.6k](/packages/jackmartin-laravel-yandex-geocode)[1001pharmacies/geolocation-bundle

Provides an abstraction layer for geocoding services.

116.8k](/packages/1001pharmacies-geolocation-bundle)

PHPackages © 2026

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