PHP code example of noxxienl / nladdresslexer

1. Go to this page and download the library: Download noxxienl/nladdresslexer 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/ */

    

noxxienl / nladdresslexer example snippets


use noxxienl\nladdresslexer\Parser;

$parser = new Parser;
$parser->evaluate('Plein 1926 12 A');

echo $parser->getStreet() . "\r\n"; // Plein 1926
echo $parser->getNumber() . "\r\n"; // 12
echo $parser->getSuffix() . "\r\n"; // A

echo $parser->getOriginalString();

use noxxienl\nladdresslexer\Parser;

$parser = new Parser;

list($number, $street) = explode(', ', '50 A, Ringweg Zuid / Rijksweg A20');
$parser->evaluate($street, $number);

echo $parser->getStreet() . "\r\n"; // Ringweg Zuid / Rijgsweg A20
echo $parser->getNumber() . "\r\n"; // 50
echo $parser->getSuffix() . "\r\n"; // A

echo $parser->getOriginalString();

Parser::setAddressFormat([
    Parser::T_NUMBER,
    Parser::T_SUFFIX,
]);

Parser::setAddressFormat([
    Parser::T_STREET,
    Parser::T_NUMBER,
    Parser::T_SUFFIX,
]);