PHPackages                             dotzero/gmaps-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. dotzero/gmaps-geocode

AbandonedArchivedLibrary[API Development](/categories/api)

dotzero/gmaps-geocode
=====================

A PHP5 library to geocode coordinates through The Google Maps Geocoding API

0.6.0(10y ago)38.2k4[1 issues](https://github.com/zero-archive/gmaps-geocode-php/issues)MITPHPPHP &gt;=5.3.0

Since Apr 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zero-archive/gmaps-geocode-php)[ Packagist](https://packagist.org/packages/dotzero/gmaps-geocode)[ RSS](/packages/dotzero-gmaps-geocode/feed)WikiDiscussions master Synced 4w ago

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

PHP Google Maps Geocode
=======================

[](#php-google-maps-geocode)

[![Build Status](https://camo.githubusercontent.com/41ffa65cea210ebd62447857d29298e1dbef89ab90d6af51834ca172af6c40c9/68747470733a2f2f7472617669732d63692e6f72672f646f747a65726f2f676d6170732d67656f636f64652d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dotzero/gmaps-geocode-php)[![Latest Stable Version](https://camo.githubusercontent.com/874d81e527d161dfeddb1e1a9fda9d63380d43416e28e078fedd39af045dff3b/68747470733a2f2f706f7365722e707567782e6f72672f646f747a65726f2f676d6170732d67656f636f64652f76657273696f6e)](https://packagist.org/packages/dotzero/gmaps-geocode)[![License](https://camo.githubusercontent.com/ccc64e42c352ea0a4cb841d2eba3ffc70b104684f2624b536cc57a4ee2988a83/68747470733a2f2f706f7365722e707567782e6f72672f646f747a65726f2f676d6170732d67656f636f64652f6c6963656e7365)](https://packagist.org/packages/dotzero/gmaps-geocode)

A PHP5 library implements Geocoding and Reverse geocoding through The Google Maps Geocoding API.

Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739). Reverse geocoding is the process of converting geographic coordinates into a human-readable address.

Usage
-----

[](#usage)

To use the Google Maps Geocoding API, you need an API key. To acquire an API key follow [the instructions](https://developers.google.com/maps/documentation/geocoding/get-api-key).

### Geocoding (Latitude/Longitude Lookup)

[](#geocoding-latitudelongitude-lookup)

```
try {
    $result = (new GMapsGeocode('YOUR_GOOGLE_API'))
        ->setAddress('Helsinki')
//        ->setRegion('FI')
        ->setComponents(array(
            'route' => 'Annegatan',
            'administrative_area' => 'Helsinki',
            'country' => 'Finland'
        ))
        ->search();

    print_r($result);
} catch (GMapsException $e) {
    printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}
```

Required method are `setAddress` or `setComponents` in a geocoding request and `setRegion` is optional.

[Official documentation](https://developers.google.com/maps/documentation/geocoding/intro?hl=en#ComponentFiltering) contains more about Component Filtering.

### Reverse Geocoding (Address Lookup)

[](#reverse-geocoding-address-lookup)

```
try {
    $geo = (new GMapsGeocodeReverse('YOUR_GOOGLE_API'))
        ->setLatLng('40.714224', '-73.961452')
//        ->setPlaceId('ChIJd8BlQ2BZwokRAFUEcm_qrcA')
        ->search();

    print_r($result);
} catch (GMapsException $e) {
    printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}
```

Required method are `setLatLng` or `setPlaceId` in a reverse geocoding request.

Install
-------

[](#install)

### Via composer:

[](#via-composer)

```
$ composer require dotzero/gmaps-geocode
```

### Without composer

[](#without-composer)

Clone the project using:

```
$ git clone https://github.com/dotzero/gmaps-geocode-php/
```

and include the source files with:

```
    require_once("gmaps-geocode-php/src/GMapsException.php");
    require_once("gmaps-geocode-php/src/GMapsGeocodeBase.php");
    require_once("gmaps-geocode-php/src/GMapsGeocode.php");
    require_once("gmaps-geocode-php/src/GMapsGeocodeReverse.php");
```

Test
----

[](#test)

First install the dependencies, and after you can run:

```
GOOGLE_API=YOUR_GOOGLE_API vendor/bin/phpunit
```

License
-------

[](#license)

Licensed under the MIT license:

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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

3731d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/265633?v=4)[dotzero](/maintainers/dotzero)[@dotzero](https://github.com/dotzero)

---

Top Contributors

[![dotzero](https://avatars.githubusercontent.com/u/265633?v=4)](https://github.com/dotzero "dotzero (20 commits)")[![Rpsl](https://avatars.githubusercontent.com/u/265634?v=4)](https://github.com/Rpsl "Rpsl (2 commits)")

---

Tags

geocodinggooglephpapimapsgeocodegoogl

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yandex/geo

PHP-library for interactions with geo-coding Yandex.Maps

116313.2k3](/packages/yandex-geo)[jeroendesloovere/geolocation-php-api

This Geolocation PHP class connects to Google Maps API to find latitude/longitude or address.

76321.1k4](/packages/jeroendesloovere-geolocation-php-api)[dantsu/php-osm-static-api

PHP library to easily get static image from OpenStreetMap (OSM), add markers and draw lines.

97154.8k1](/packages/dantsu-php-osm-static-api)[jcf/geocode

Google Geocoding API for Laravel

48162.2k](/packages/jcf-geocode)[ok/ipstack-client

A PHP wrapper for using Ipstack API

10391.9k](/packages/ok-ipstack-client)[jackmartin/laravel-yandex-geocode

Simply service laravel Yandex Geocoding

1017.3k](/packages/jackmartin-laravel-yandex-geocode)

PHPackages © 2026

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