PHPackages                             drawmyattention/phpaddressr - 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. drawmyattention/phpaddressr

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

drawmyattention/phpaddressr
===========================

An address cleaner, normaliser written in PHP. Includes implementation to use the SmartyStreets.com api for US address cleaning, and Google Geocoding.

1.1.0(10y ago)19931MITPHP

Since Oct 5Pushed 10y ago3 watchersCompare

[ Source](https://github.com/amochohan/phpaddressr)[ Packagist](https://packagist.org/packages/drawmyattention/phpaddressr)[ RSS](/packages/drawmyattention-phpaddressr/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

PHPAddressr
===========

[](#phpaddressr)

PHPAddressr is a framework agnostic set of methods that allows easy postcode / zipcode lookups, and conversion of addresses to longitude and latitude values via Google's mapping APIs.

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/49a609b0b8fcfcc061bf31bcb7009118dd585f6e4bec817ffac398a943568471/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f647261776d79617474656e74696f6e2f70687061646472657373722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/drawmyattention/phpaddressr/?branch=master)[![Build Status](https://camo.githubusercontent.com/02a62d2d4e237050b1278d8ca4fa05d5c8a13852b1135c7907ace0d6389b93b4/68747470733a2f2f7472617669732d63692e6f72672f647261776d79617474656e74696f6e2f70687061646472657373722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/drawmyattention/phpaddressr)[![License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://www.opensource.org/licenses/MIT)

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

[](#installation)

Composer is the easiest way to install PHPAddressr.

```
composer require drawmyattention/phpaddressr

```

Api Key
-------

[](#api-key)

Google's geocoding API requires an API key in order to function. A key can be generated via their [official API website](https://developers.google.com/maps/documentation/geocoding/intro). Please keep your API key safe, and outside of source control.

Once you have an API key, edit the `config.php` file to specify your key.

Alternatively, you can set the Api key using the `setApiKey()` method in the GoogleGeocode class.

Usage
-----

[](#usage)

### Finding the longitude / latitude of an address

[](#finding-the-longitude--latitude-of-an-address)

```
$geocode = new DrawMyAttention\PHPAddressr\GoogleGeocode();

// Optional, if a key hasn't been provided in the config file.
$geocode->setApiKey('123abc');

$latLng = $geocode->getLatLng([
    'building'  => 'Dock offices'
    'street'    => 'Surrey Quays Road',
    'city'      => 'London',
    'state'     => 'Greater London',
    'postcode'  => 'SE16 2XU',
    'country'   => 'United Kingdom'
]);

/*
    array(2) {
      'longitude' =>
      double(-0.0507361)
      'latitude' =>
      double(51.4965262)
    }
*/

```

**Note:** Not all address values are required, however the higher number of accurate address parameters that are passed, the higher the accuracy of the longitude and latitude that is returned.

### Finding an address by postcode

[](#finding-an-address-by-postcode)

```
$geocode = new DrawMyAttention\PHPAddressr\GoogleGeocode();

$address = $geocode->getFullAddressByPostcode('SE16 2XU');

// An Address instance is returned.

/*
    class DrawMyAttention\PHPAddressr\Address#4 (4) {
      private $address =>
      array(7) {
        'company' =>
        class DrawMyAttention\PHPAddressr\Data#9 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'building' =>
        class DrawMyAttention\PHPAddressr\Data#10 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'street' =>
        class DrawMyAttention\PHPAddressr\Data#5 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(17) "Surrey Quays Road"
          public $updated =>
          string(0) ""
        }
        'city' =>
        class DrawMyAttention\PHPAddressr\Data#6 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(6) "London"
          public $updated =>
          string(0) ""
        }
        'state' =>
        class DrawMyAttention\PHPAddressr\Data#7 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(14) "Greater London"
          public $updated =>
          string(0) ""
        }
        'postcode' =>
        class DrawMyAttention\PHPAddressr\Data#11 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'country' =>
        class DrawMyAttention\PHPAddressr\Data#8 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(14) "United Kingdom"
          public $updated =>
          string(0) ""
        }
      }
      private $longitude =>
      double(-0.051054)
      private $latitude =>
      double(51.4967696)
*/

```

Contributing
------------

[](#contributing)

Please submit any contributions via a pull request. Any submissions should be backed by tests in order to be merged.

Licence
-------

[](#licence)

This project is open-sourced software licenced under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% 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 ~3 days

Total

2

Last Release

3911d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a8a6d7576ffbce954cdfe28b99409f1575f9ebea23ece6e6bd0498e0d5d9159?d=identicon)[drawmyattention](/maintainers/drawmyattention)

---

Top Contributors

[![amochohan](https://avatars.githubusercontent.com/u/2978619?v=4)](https://github.com/amochohan "amochohan (20 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/drawmyattention-phpaddressr/health.svg)

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

PHPackages © 2026

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