1. Go to this page and download the library: Download popphp/pop-parser 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/ */
popphp / pop-parser example snippets
use Pop\Parser\Address\AddressParser;
$parser = new AddressParser();
$result = $parser->parse('123 Main St Apt 4B, Springfield, IL 62704');
$result->getStreetNumber(); // '123'
$result->getStreetName(); // 'Main'
$result->getRouteType(); // 'St'
$result->getUnit(); // 'Apt 4B'
$result->getCity(); // 'Springfield'
$result->getStateCode(); // 'IL'
$result->getStateName(); // 'Illinois'
$result->getPostalCode(); // '62704'
$result->getCountry(); // 'US'
$parser = new AddressParser('123 Main St, Springfield, IL 62704');
$result = $parser->parse();
$parser = new AddressParser();
$result = $parser->parse('456 N Elm Street, Chicago, IL 60601');
$result->getDirection(); // 'N'
$result->getStreetName(); // 'N Elm'
$result->getStreetName(false); // 'Elm'
$result->getRouteType(); // 'Street'
$result->getFullAddress();
// '123 Main St, Apt 4B, Springfield, IL 62704'
// Options: delimiter, whether to use the state code vs. full state name, whether to 'streetName' => 'Main', 'routeType' => 'St',
// 'direction' => null, 'unit' => 'Apt 4B', 'city' => 'Springfield',
// 'postalCode' => '62704', 'zip4' => null, 'stateName' => 'Illinois',
// 'stateCode' => 'IL', 'country' => 'US', 'confidence' => 1.0,
// ]
(string) $result; // same as getFullAddress()
$result->getConfidence(); // 1.0
$result->isConfident(); // true (default threshold: 0.7)
$result->isConfident(0.9); // pass a stricter threshold if you need one
use Pop\Parser\Name\NameParser;
$parser = new NameParser();
$result = $parser->parse('Dr. John Michael Smith Jr.');
$result->getSalutation(); // 'Dr.'
$result->getFirstname(); // 'John'
$result->getMiddlename(); // 'Michael'
$result->getLastname(); // 'Smith'
$result->getSuffix(); // 'Jr'
$result->getFullName(); // 'John Michael Smith'
(string) $result; // 'Dr. John Michael Smith Jr'
$parser = new NameParser('John Smith');
$result = $parser->parse();