PHPackages                             powderblue/geocoding-api - 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. powderblue/geocoding-api

ActiveProject[API Development](/categories/api)

powderblue/geocoding-api
========================

A basic PHP client for working with Google's Geocoding API

v4.0.0(2y ago)01.1k—0%ISCPHPPHP ^7.4|^8.1.3

Since Jul 7Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

Geocoding API
=============

[](#geocoding-api)

A basic PHP client for working with [Google's Geocoding API](https://developers.google.com/maps/documentation/geocoding).

Note

Only PHP7+ and the cURL extension are required: in a production environment there are no other dependencies

Demo
----

[](#demo)

If you'd like to see the library in action then you can execute `tests/geocode.php`, which runs a bunch of tests on the various `Geocode` methods.

Important

Before running `tests/geocode.php`, you must add a project's API key to `tests/.config.php`

Return Value
------------

[](#return-value)

The geocoding methods, including `Geocode::byAddress()` and `Geocode::byPostcode()`, return an array on success, or throw an exception otherwise. The structure of the array is based on the [Schema.org *GeoCoordinates* type](https://schema.org/GeoCoordinates) and looks like the following.

```
Array
(
    [address] => Array
        (
            [streetAddress] => 25 Old Gardens Close
            [addressLocality] => Tunbridge Wells
            [addressRegion] => Kent
            [postalCode] => TN2 5ND
            [addressCountry] => GB
        )

    [latitude] => 51.1172303
    [longitude] => 0.2635245
)
```

Forward Geocoding
-----------------

[](#forward-geocoding)

Examples of geocoding an address using the convenience method:

```
$geocode = new Geocode('');

// Without using region biasing
$geoCoordinates = $geocode->byAddress('25 Old Gardens Close Tunbridge Wells TN2 5ND');

// `byAddress()` accepts an *ISO 3166-1 alpha-2 code* to apply bias by a specific country
$geoCoordinates = $geocode->byAddress('25 Old Gardens Close Tunbridge Wells TN2 5ND', 'GB');
```

An example of geocoding a postcode using the convenience method:

```
$geocode = new Geocode('');

// `byPostcode()` *requires* a country; this is to help reduce ambiguity and, therefore, improve results
$geoCoordinates = $geocode->byPostcode('07001', 'ES');
  // => Palma, Majorca
```

Reverse Geocoding
-----------------

[](#reverse-geocoding)

An example of reverse-geocoding using the convenience method:

```
$geocode = new Geocode('');
$geoCoordinates = $geocode->byLatLong('50.88916732998306', '-0.5768395884825535');
  // => Arundel, West Sussex, GB
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Recently: every ~71 days

Total

7

Last Release

762d ago

Major Versions

v1.0.2 → v2.0.02023-07-08

v2.0.0 → v3.0.02023-07-10

v3.0.1 → v4.0.02024-04-16

### Community

Maintainers

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

---

Top Contributors

[![danbettles](https://avatars.githubusercontent.com/u/736672?v=4)](https://github.com/danbettles "danbettles (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/powderblue-geocoding-api/health.svg)

```
[![Health](https://phpackages.com/badges/powderblue-geocoding-api/health.svg)](https://phpackages.com/packages/powderblue-geocoding-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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