PHP Helper class for dealing with UK postcodes.
Used to break postcodes in to parts based on
https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Formatting
Break in to parts
<?php
$postcode = new Postcode('SR5 1NA');
$postcode->get(); // SR51NA
$postcode->getOutward(); //SR5
$postcode->getInward(); // 1NA
$postcode->getArea(); // SR
$postcode->getDistrict(); // 5
$postcode->getSector(); // 1
$postcode->getUnit(); // NAValidate a postcode
<?php
$good = Postcode::validate('SR5 1nA'); // true
$bad = Postcode::validate('SR5 N1A'); // falseFormat Postcodes in a consistent way
<?php
$formatted = Postcode::format('Sr51NA'); // SR51NA
$formatted = Postcode::format('sR5 1NA'); // SR51NAPull a postcode from an address string
<?php
$postcode = Postcode::findInString('1 Fake Street, Fake Vil, Fake Country, SR51NA');