ankalagon/vies-address-formatter

Library to format data from VIES service (http://ec.europa.eu/taxation_customs/vies/?locale=en)

1.1.0 2018-11-19 08:32 UTC

This package is auto-updated.

Last update: 2024-11-20 00:48:30 UTC


README

Service can recognize postal_code, city and address (rest of address line) from address provided by VIES service (http://ec.europa.eu/taxation_customs/vies/?locale=en).

Requirements

  • PHP5.3 and above

or

  • PHP7.0 and above

Installation

Update your composer.json and run composer update

{
    "require": {
        "ankalagon/vies-address-formatter": "^1.0"
    }
}

or execute

composer require ankalagon/vies-address-formatter

Usage

    use Ankalagon\ViesAddressFormatter\ViesFormatter;

    $result = ViesFormatter::recognize("GB", "254 BANNERDALE ROAD<br>SHEFFIELD<br>S11 9FE");

    print_r($result);

the above example will produce the following output:

Array (
    [city] => Sheffield
    [postal_code] => S11 9FE
    [address] => 254 Bannerdale Road
)

Example address line recognizion

Thanks to

Special thanks to Matthew Bednarski for postal-code.json library (https://gist.github.com/matthewbednarski/4d15c7f50258b82e2d7e). I use it (with small modfications) in this project.