PHPackages                             nicoka49/address-format - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. nicoka49/address-format

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

nicoka49/address-format
=======================

A PHP library to parse street addresses to localized formats

1.0.1(3y ago)0100MITPHPPHP &gt;=5.3.0

Since Sep 20Pushed 3y agoCompare

[ Source](https://github.com/nicoka49/address-format)[ Packagist](https://packagist.org/packages/nicoka49/address-format)[ Docs](https://github.com/nicoka49/address-format)[ RSS](/packages/nicoka49-address-format/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Address Format
==============

[](#address-format)

[![Latest Version](https://camo.githubusercontent.com/1cbd535ebf7fbb045fd67c07510ed6c7b39efc8e21f67171cf06006e509dec1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6164616d6c632f616464726573732d666f726d61742e7376673f6c6162656c3d72656c65617365267374796c653d666c61742d737175617265)](https://github.com/adamlc/address-format/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/c7df168050d45fd4229e4e2033358cb3279a85def07781f96635881b59e553f6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6164616d6c632f616464726573732d666f726d61742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/adamlc/address-format)[![Coverage Status](https://camo.githubusercontent.com/fc6c4af3325d0e32a719e73738fe3b9f87f8355f3a6fb5d3be8ed56e1af06652/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6164616d6c632f616464726573732d666f726d61742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/adamlc/address-format/code-structure)[![Quality Score](https://camo.githubusercontent.com/b3efb3ec59929b77e6d38047a53ab2835622c3c709f1907b346bdaa5b7a7781e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6164616d6c632f616464726573732d666f726d61742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/adamlc/address-format)[![Total Downloads](https://camo.githubusercontent.com/2b7684d1b100d947dbff0a58224908cb6f24cc628b353aaf36a7788e00515aed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6164616d6c632f616464726573732d666f726d61742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adamlc/address-format)

A PHP library to parse street addresses to localized formats. The address formats are based on the formats supplied by Google's libaddressinput.

I have written a few basic unit tests, but they could probably be improved. Feel free to submit a pull request if you improve them!

Composer
--------

[](#composer)

To install AddressFormat as a Composer package add this to your composer.json:

```
"adamlc/address-format": "~1.3"
```

Run `composer update`

Formatting a Street Address
---------------------------

[](#formatting-a-street-address)

```
//Create an address formatter instance
$address_formatter = new Adamlc\AddressFormat\Format;

//Set a locale using a two digit ISO country code.
$address_formatter->setLocale('GB');

//Set the address parts / attributes
$address_formatter['ADMIN_AREA'] = 'London';
$address_formatter['LOCALITY'] = 'Greenwich';
$address_formatter['RECIPIENT'] = 'Joe Bloggs';
$address_formatter['ORGANIZATION'] = 'Novotel London';
$address_formatter['POSTAL_CODE'] = 'SE10 8JA';
$address_formatter['STREET_ADDRESS'] = '173-185 Greenwich High Road';
$address_formatter['COUNTRY'] = 'United Kingdom';

//Get the address in localised format
$html = true; // Optional - return the address in HTML  instead of \n new lines

echo $address_formatter->formatAddress($html);
```

The above code will produce the following:

```
Joe Bloggs
Novotel London
173-185 Greenwich High Road
Greenwich
London
SE10 8JA

```

Note: Look in the i18n directory to view the meta data for the locales.

The following attributes are available:

ADMIN\_AREA
LOCALITY
RECIPIENT
ORGANIZATION
DEPENDENT\_LOCALITY
POSTAL\_CODE
SORTING\_CODE
STREET\_ADDRESS
COUNTRY

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.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 ~0 days

Total

2

Last Release

1327d ago

### Community

Maintainers

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

---

Top Contributors

[![adamlc](https://avatars.githubusercontent.com/u/809944?v=4)](https://github.com/adamlc "adamlc (32 commits)")[![nicoka49](https://avatars.githubusercontent.com/u/108870411?v=4)](https://github.com/nicoka49 "nicoka49 (3 commits)")[![travisulrich](https://avatars.githubusercontent.com/u/6855038?v=4)](https://github.com/travisulrich "travisulrich (3 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![mikemand](https://avatars.githubusercontent.com/u/745184?v=4)](https://github.com/mikemand "mikemand (1 commits)")[![chandon](https://avatars.githubusercontent.com/u/4522557?v=4)](https://github.com/chandon "chandon (1 commits)")[![ickbinhier](https://avatars.githubusercontent.com/u/2810904?v=4)](https://github.com/ickbinhier "ickbinhier (1 commits)")

### Embed Badge

![Health badge](/badges/nicoka49-address-format/health.svg)

```
[![Health](https://phpackages.com/badges/nicoka49-address-format/health.svg)](https://phpackages.com/packages/nicoka49-address-format)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M283](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M343](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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