PHPackages                             kamranahmedse/php-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. kamranahmedse/php-geocode

Abandoned → [hugobots/php-geocode](/?search=hugobots%2Fphp-geocode)Library[API Development](/categories/api)

kamranahmedse/php-geocode
=========================

A wrapper around the Google Geocoding API to get different details such as latitude, longitude, country, city, district, postcode, town and street number regarding some specific address.

v2.0(10y ago)134.7k4MITPHPPHP &gt;=5.3.0

Since Oct 7Pushed 8y agoCompare

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

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

---

No longer maintained, a better alternative would be [geocoder-php](https://github.com/geocoder-php/Geocoder)

---

PHP Geocode
===========

[](#php-geocode)

[![Build Status](https://camo.githubusercontent.com/79120703a28a5c94ccbcd3f1a2ff472a631312ed90ca162351cad67526d8d4b8/68747470733a2f2f7472617669732d63692e6f72672f6875676f626f74732f7068702d67656f636f64652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugobots/php-geocode)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/66194d1f7e354a94fc3ba1b707810ca55928d8ba47ad668ed26210429777a1e7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6875676f626f74732f7068702d67656f636f64652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/hugobots/php-geocode/?branch=master)

A wrapper around the Google Geocoding API to get different details regarding an address such as

- Latitude/longitude
- Country
- City
- District
- Postcode
- Town
- Street number

Requirement
-----------

[](#requirement)

PHP &gt;= 5.4.0 and `curl` enabled server.

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

[](#installation)

You can install the library using the following ways

Composer
--------

[](#composer)

The recommended installation method is through [Composer](http://getcomposer.org/), a dependency manager for PHP. Just add `hugobots/php-geocode` to your project's `composer.json` file:

```
{
    "require": {
        "hugobots/php-geocode": "*"
    }
}
```

and then run `composer install`. For further details you can find the package at [Packagist](https://packagist.org/packages/hugobots/php-geocode).

Manual way
----------

[](#manual-way)

Or you can install the package manually by:

- Copy `src/php-geocode.php` to your codebase, perhaps to the vendor directory.
- Add the `Geocode` class to your autoloader or require the file directly.

Getting Started
---------------

[](#getting-started)

I'm going to use the following address to explain the use of library i.e.

> 1600 Amphitheatre Parkway, Mountain View, CA

Instantiate the `Geocode` class and call the methods as follows

```
// Introduce the class into your scope
use KamranAhmed\Geocode\Geocode;

// Optionally you can pass the API key for Geocoding
$geocode = new Geocode();

// Get the details for the passed address
$location = $geocode->get("1600 Amphitheatre Parkway, Mountain View, CA");

// Note: All the functions below accept a parameter as a default value that will be return if the reuqired value isn't found
$location->getAddress( 'default value' );
$location->getLatitude(); // returns the latitude of the address
$location->getLongitude(); // returns the longitude of the address
$location->getCountry(); // returns the country of the address
$location->getLocality(); // returns the locality/city of the address
$location->getDistrict(); // returns the district of the address
$location->getPostcode(); // returns the postal code of the address
$location->getTown(); // returns the town of the address
$location->getStreetNumber(); // returns the street number of the address
$location->getNeighborhood(); // returns the neighborhood of the address
```

Feedback
--------

[](#feedback)

I'd love to hear what you have to say. Please open an issue for any feature requests that you may want or the bugs that you notice. Also you can contact me at [](mailto:kamranahmed.se@gmail.com) or you can also find me at twitter [@kamranahmedse](http://twitter.com/kamranahmedse)

Note
====

[](#note)

It should be noted that, the Google Geocoding API has the following limits in place and you should keep them in mind before using this wrapper:

- 2,500 requests per 24 hour period.
- 5 requests per second.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 73.6% 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 ~236 days

Total

3

Last Release

3761d ago

Major Versions

v1.1 → v2.02016-01-22

PHP version history (2 changes)v1.0PHP &gt;=5.2.0

v1.1PHP &gt;=5.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e119260b816ceaf3e92000b32fc38122e255b463ec0c23b37568f46da2ac0b77?d=identicon)[kamranahmedse](/maintainers/kamranahmedse)

---

Top Contributors

[![kamranahmedse](https://avatars.githubusercontent.com/u/4921183?v=4)](https://github.com/kamranahmedse "kamranahmedse (81 commits)")[![ckdarby](https://avatars.githubusercontent.com/u/220283?v=4)](https://github.com/ckdarby "ckdarby (16 commits)")[![iannsp](https://avatars.githubusercontent.com/u/40551?v=4)](https://github.com/iannsp "iannsp (11 commits)")[![bennyt2](https://avatars.githubusercontent.com/u/5905154?v=4)](https://github.com/bennyt2 "bennyt2 (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

geocodinggeocoderaddressgooglemapmapslocationaddressesgeocodegmapgmaps

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[jcf/geocode

Google Geocoding API for Laravel

48160.5k](/packages/jcf-geocode)[yandex/geo

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

117309.0k3](/packages/yandex-geo)[opencage/geocode

A PHP library for geocoding via the OpenCage Geocoder API

37480.0k4](/packages/opencage-geocode)[biscolab/google-maps-php-sdk

Google Maps PHP SDK.

14215.1k](/packages/biscolab-google-maps-php-sdk)[jackmartin/laravel-yandex-geocode

Simply service laravel Yandex Geocoding

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

PHPackages © 2026

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