https://github.com/baikho/belgian-address-parser-php
A Belgian address parser library in PHP
https://github.com/baikho/belgian-address-parser-php
Last synced: about 1 month ago
JSON representation
A Belgian address parser library in PHP
- Host: GitHub
- URL: https://github.com/baikho/belgian-address-parser-php
- Owner: baikho
- License: mit
- Created: 2025-03-24T14:20:11.000Z (about 2 months ago)
- Default Branch: 1.x
- Last Pushed: 2025-03-24T15:27:33.000Z (about 2 months ago)
- Last Synced: 2025-03-24T15:42:49.672Z (about 2 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Belgian Address Parser PHP
[](https://packagist.org/packages/baikho/belgian-address-parser-php)
[](https://packagist.org/packages/baikho/belgian-address-parser-php)
[](LICENSE)
[](https://github.com/baikho/belgian-address-parser-php/issues)
[](https://github.com/baikho/belgian-address-parser-php/stargazers)A Belgian address parser library in PHP.
## Requirements
- PHP 8.1 or higher
## Installation
You can install the package via composer:
```bash
composer require baikho/belgian-address-parser-php
```
## Usage```php
// Create a parser instance
$parser = new \Baikho\BelgianAddressParser\Parser();// Parse an address
$parsed = $parser->parse('Andreas Vesaliusstraat 47, 3000 Leuven, België');// Output the parsed components
print_r($parsed);
Array
(
[recipient] =>
[street] => Andreas Vesaliusstraat
[number] => 47
[box] =>
[postal_code] => 3000
[city] => Leuven
[country] => België
)// Validate the address
$validation = $parser->validate($parsed);
if ($validation['valid']) {
echo "Address is valid!\n";
} else {
echo "Address has issues: " . implode(', ', $validation['errors']) . "\n";
}// Format the address back to string
$formatted = $parser->format($parsed);
echo $formatted;
```