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)040MITPHPPHP &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 1mo ago

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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

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

1032d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f61509fe723e08a9f67f75aa69402ec7474eaf6b41001b281b1159ff0f2bc5a?d=identicon)[osmsupport](/maintainers/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

[markrogoyski/ipv4-subnet-calculator

Network calculator for subnet mask and other classless (CIDR) network information.

177813.7k6](/packages/markrogoyski-ipv4-subnet-calculator)[sylius/addressing-bundle

Addressing and zone management for Symfony applications.

33221.4k3](/packages/sylius-addressing-bundle)[tapp/filament-google-autocomplete-field

Filament plugin that provides a Google Autocomplete field

3098.1k](/packages/tapp-filament-google-autocomplete-field)[yieldstudio/nova-google-autocomplete

A Laravel Nova Google autocomplete field.

12218.4k](/packages/yieldstudio-nova-google-autocomplete)[nonsapiens/realaddressfactory

Creates real-world street addresses from Google Maps, to use in database seeding, unit tests, or anything else. Supports Laravel 11+, and Faker

4910.2k7](/packages/nonsapiens-realaddressfactory)

PHPackages © 2026

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