PHPackages                             osmsupport/address-formatter - 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. osmsupport/address-formatter

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

osmsupport/address-formatter
============================

Address formatter using country templates from https://github.com/OpenCageData/address-formatting

v9.0.0(2y ago)041MITPHPPHP &gt;=7.1.3

Since Jul 13Pushed 2y agoCompare

[ Source](https://github.com/osmsupport/address-formatter-php)[ Packagist](https://packagist.org/packages/osmsupport/address-formatter)[ RSS](/packages/osmsupport-address-formatter/feed)WikiDiscussions master Synced today

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

Address Formatter for PHP
=========================

[](#address-formatter-for-php)

[![Build Status](https://camo.githubusercontent.com/d5facb94232147d149ccddc3e72293204c08b716be710fa141beda1a7922bad0/68747470733a2f2f7472617669732d63692e6f72672f7072656469637468712f616464726573732d666f726d61747465722d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/predicthq/address-formatter-php)[![Coverage Status](https://camo.githubusercontent.com/2baa9eeef375acf91fc6c7eb0e3b662c938471dc581c577d838b9e71d85ea2ab/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7072656469637468712f616464726573732d666f726d61747465722d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/predicthq/address-formatter-php?branch=master)

This library uses the address templates from  to format addresses differently depending on the country.

### Installation

[](#installation)

Install the latest version with

```
$ composer require osmsupport/address-formatter
```

### Examples

[](#examples)

You can use either the `Address` object or provide an array of address parts.

```
use PredictHQ\AddressFormatter\Address;

$a = new Address();
$a->setCity('Wellington')
  ->setCountry('New Zealand')
  ->setCountryCode('NZ')
  ->setCounty('Wellington City')
  ->setHouseNumber(53)
  ->setPostcode(6011)
  ->setRoad('Pirie Street')
  ->setState('Wellington')
  ->setSuburb('Mount Victoria');

$text = $a->format();

/**
 * Will display as:
 *
 * 53 Pirie Street
 * Mount Victoria
 * Wellington 6011
 * New Zealand
 */
echo $text;
```

Or, pass an array of address parts to the `Formatter`.

```
use PredictHQ\AddressFormatter\Formatter;

$address = [
  'city' => 'Wellington',
  'country' => 'New Zealand',
  'country_code' => 'NZ',
  'county' => 'Wellington City',
  'house_number' => 53,
  'postcode' => 6011,
  'road' => 'Pirie Street',
  'state' => 'Wellington',
  'suburb' => 'Mount Victoria',
];

/**
 * Will display as:
 *
 * 53 Pirie Street
 * Mount Victoria
 * Wellington 6011
 * New Zealand
 */
$f = new Formatter();
$actual = $f->formatArray($address);
```

### Tests

[](#tests)

Run tests using `./vendor/bin/phpunit`

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.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

Unknown

Total

1

Last Release

1085d ago

### Community

Maintainers

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

---

Top Contributors

[![robertkern](https://avatars.githubusercontent.com/u/2150042?v=4)](https://github.com/robertkern "robertkern (37 commits)")[![osmsupport](https://avatars.githubusercontent.com/u/86071506?v=4)](https://github.com/osmsupport "osmsupport (2 commits)")[![kanariezwart](https://avatars.githubusercontent.com/u/606929?v=4)](https://github.com/kanariezwart "kanariezwart (1 commits)")[![tphipps](https://avatars.githubusercontent.com/u/2239044?v=4)](https://github.com/tphipps "tphipps (1 commits)")

---

Tags

addresspredicthq

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/osmsupport-address-formatter/health.svg)

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

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[altis/local-server

Local Server module for Altis

18221.6k3](/packages/altis-local-server)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k13](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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