PHP code example of michielgerritsen / extract-address-parts
1. Go to this page and download the library: Download michielgerritsen/extract-address-parts library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
michielgerritsen / extract-address-parts example snippets
use MichielGerritsen\ExtractAddressParts\AddressExtraction;
use MichielGerritsen\ExtractAddressParts\PrecisionAddressExtraction;
use MichielGerritsen\ExtractAddressParts\CombinedAddressExtraction;
use MichielGerritsen\ExtractAddressParts\VO\AddressExtractionResult;
use MichielGerritsen\ExtractAddressParts\Exceptions\AddressExtractionError;
/** @var AddressExtractionResult $result */
try {
$result = (new AddressExtraction())->process(['Kerkstraat 95A']);
$result = (new PrecisionAddressExtraction())->process(['Kerkstraat 95A']);
$result = (new CombinedAddressExtraction())->process(['Kerkstraat 95A']);
} catch (AddressExtractionError $exception) {
die('Uh oh, this address seems to be invalid.');
}
$result->getStreet(); // Kerkstraat
$result->getHousenumber(); // 95
$result->getAddition(); // A