https://github.com/sbolch/address-parser
https://github.com/sbolch/address-parser
address parser
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sbolch/address-parser
- Owner: sbolch
- License: mit
- Created: 2020-06-29T15:38:09.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-01-22T20:04:39.000Z (over 2 years ago)
- Last Synced: 2025-08-06T18:57:55.066Z (11 months ago)
- Topics: address, parser
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Address Parser
> Can parse a physical address into its parts.
## Installation
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this package:
```console
$ composer require sbolch/address-parser
```
This command requires you to have Composer installed globally, as explained
in the [installation chapter](https://getcomposer.org/doc/00-intro.md)
of Composer documentation.
## Usage
```php
$locale = 'HU';
$parser = new \sbolch\AddressParser\Parser($locale);
$parser->parse('1152 Budapest, Szentmihályi út 167');
/*
This returns:
Array
(
[zip] => 1152
[city] => Budapest
[street] => Szentmihályi
[streetType] => út
[houseNumber] => 167
[houseNumberInfo] =>
)
*/
```
Note: Only Hungarian address format is supported yet. You can request another
locale for me to do or create a pull request by implementing
\sbolch\AddressParser\ParserInterface into \sbolch\AddressParser\Parser namespace
with your own locale's class. You can place your custom files into the
locales folder under your locale.