2017 © Pedro Peláez
 

library address-formatter

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

image

predicthq/address-formatter

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

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 14 % Grown

The README.md

Address Formatter for PHP

Build Status Coverage Status, (*1)

This library uses the address templates from https://github.com/OpenCageData/address-formatting to format addresses differently depending on the country., (*2)

Installation

Install the latest version with, (*3)

$ composer require predicthq/address-formatter

Examples

You can use either the Address object or provide an array of address parts., (*4)

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., (*5)

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

Run tests using ./vendor/bin/phpunit, (*6)

The Versions

23/05 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

address predicthq

23/05 2018

v1.1.0

1.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

address predicthq

03/10 2017

v1.0.5

1.0.5.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

address predicthq

28/04 2016

v1.0.4

1.0.4.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

address predicthq

26/04 2016

v1.0.2

1.0.2.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

26/04 2016

v1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

26/04 2016

v1.0.0

1.0.0.0

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

  Sources   Download

The Requires

 

The Development Requires

26/04 2016

v1.0.0-beta1

1.0.0.0-beta1

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

  Sources   Download

The Requires

 

The Development Requires