Symfony 1 plugin to support the PostcodeAnywhere API
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits behind Wirehive:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Symfony 1 plugin to support the PostcodeAnywhere API

Setup & Configuration

You will need to register an account with PostcodeAnywhere. Copy or rename the app.yml.dist file to app.yml, or copy the content to your project or application app.yml. Fill in the details (minimum required is licence key, obtained from PostcodeAnywhere). Alternatively you can provide the details when constructing the object: new sfPostcodeAnywhere('accountCode', 'licenceKey', 'serviceUrl')


Validating an email address

$pa = new sfPostcodeAnywhere();
$isValid = $pa->validateEmail('');

You can also capture back which bits of the email validator passed/failed - this can be used if you only care about syntax and not if there is a valid mail server, etc.

$pa = new sfPostcodeAnywhere();
$pa->validateEmail('', $result);
$isValid = $result['ValidFormat'];

Validating a UK postal address

$pa = new sfPostcodeAnywhere();
$isValid = $pa->validateAddressUK($results, 'AA11 1AA');

The results array will contain a list of all the address found against the supplied postcode (if valid).

You can also validate that a place or street address exists for a given postcode.

$pa = new sfPostcodeAnywhere();
$isValid = $pa->validateAddressUK($results, 'AA11 1AA', 'Some Town', '1 Some Road');


Implement the rest of the API calls.