ankalagon / vies-address-formatter
Library to format data from VIES service (http://ec.europa.eu/taxation_customs/vies/?locale=en)
Installs: 27 566
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2025-03-20 01:29:18 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
Iso Code | Address line | Return data |
---|---|---|
GB | C/O BMW UK GROUPTAX FR-3-UK SUMMIT ONE SUMMIT AVENUE FARNBOROUGH GU14 0FB |
Array ( [city] => Farnborough [postal_code] => GU14 0FB [address] => C/o Bmw Uk Grouptax Fr-3-uk Summit One Summit Avenue ) |
GB | 28-29 THE BROADWAY EALING LONDON W5 2NP |
Array ( [city] => London [postal_code] => W5 2NP [address] => 28-29 The Broadway Ealing ) |
GB | 10 THE GRANGEWAY GRANGE PARK LONDON N21 2HA |
Array ( [city] => London [postal_code] => N21 2HA [address] => 10 The Grangeway Grange Park ) |
GB | 254 BANNERDALE ROAD SHEFFIELD S11 9FE |
Array ( [city] => Sheffield [postal_code] => S11 9FE [address] => 254 Bannerdale Road ) |
PT | R FIGUEIRAS N 616 MAIA 4475-011 MAIA |
Array ( [city] => Maia [postal_code] => 4475-011 [address] => R Figueiras N 616 Maia ) |
LU | 40, RUE ANTOINE MEYER L-2153 LUXEMBOURG | Array ( [city] => Luxembourg [postal_code] => L-2153 [address] => 40, Rue Antoine Meyer ) |
NL | EEKHORSTWEG 00031 A 7942KC MEPPEL | Array ( [city] => Meppel [postal_code] => 7942KC [address] => Eekhorstweg 00031 A ) |
BE | EZELSTRAAT 69 1 8000 BRUGGE | Array ( [city] => Brugge [postal_code] => 8000 [address] => Ezelstraat 69 1 ) |
IT | P.ZA FERRAVILLA N. 2 20092 CINISELLO BALSAMO MI | Array ( [city] => Cinisello Balsamo Mi [postal_code] => 20092 [address] => P.za Ferravilla N. 2 ) |
BG | ул. Самуиловско шосе №1А обл.СЛИВЕН, гр.СЛИВЕН 8800 | Array ( [city] => [postal_code] => 8800 [address] => ул. самуиловско шосе №1а обл.сливен, гр.сливен ) |
AT | Herrengasse 44 7471 Rechnitz |
Array ( [city] => Rechnitz [postal_code] => 7471 [address] => Herrengasse 44 ) |
NO | Setesdalsveien 76 4617 KRISTIANSAND S |
Array ( [city] => Kristiansand S [postal_code] => 4617 [address] => Setesdalsveien 76 ) |
PL | KORNELA UJEJSKIEGO 12 M7 30-102 KRAKÓW |
Array ( [city] => Kraków [postal_code] => 30-102 [address] => Kornela Ujejskiego 12 M7 ) |
PL | AL. 29 LISTOPADA 155C 31-406 KRAKów |
Array ( [city] => Kraków [postal_code] => 31-406 [address] => Al. 29 Listopada 155c ) |
PL | AL. JERZEGO WASZYNGTONA 45/51 04-008 WARSZAWA |
Array ( [city] => Warszawa [postal_code] => 04-008 [address] => Al. Jerzego Waszyngtona 45/51 ) |
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.