A PHP Wrapper for the Loqate API.
composer require baikho/loqate-php
$loqate = new \Baikho\Loqate\Loqate('API Key');
// Simple example.
$result = $loqate->address()->find('foo');
// Advanced example.
$result = (new \Baikho\Loqate\Address\Find('API Key'))
->setText('foo')
->setIsMiddleWare(TRUE)
->setContainer('bar')
->setCountries('NL')
->makeRequest();
// Simple example.
$result = $loqate->address()->retrieve('XX|XX|XXX|XXXXXXXXXX');
// Advanced example.
$result = (new \Baikho\Loqate\Address\Retrieve('API Key'))
->setId('XX|XX|XXX|XXXXXXXXXX')
->makeRequest();
The only APIs currently supported are
Easting/Northing, Latitude/Longitude & Postcodes are supported.
$result = $loqate->geocoding()->distance('381600,259400', '380600,25840');
$result = $loqate->geocoding()->distance('51.4733514399,-0.00088499646', '51.492914695,-0.1215161806');
$result = $loqate->geocoding()->distance('SE10 8XJ', 'SW1A 0AA');
Easting/Northing, Latitude/Longitude & Postcodes are supported.
$result = $loqate->geocoding()->directions('381600,259400', '380600,25840');
$result = $loqate->geocoding()->directions('51.4733514399,-0.00088499646', '51.492914695,-0.1215161806');
$result = $loqate->geocoding()->directions('SE10 8XJ', 'SW1A 0AA');
Country must be supplied as an ISO2 or ISO3 country code. Location can be a postal code or place name, Loqate ID also works.
$result = $loqate->geocoding()->geocode('GB', 'London');
This can be a full or partial postcode, a place name or street comma town.
$result = $loqate->geocoding()->ukFind('London');
This can be a full or partial postcode, a place name or street comma town.
$result = $loqate->geocoding()->ukGeocode('London');
This can be a full or partial postcode, a place name or street comma town.
$result = $loqate->geocoding()->ukRetrieve('XX|XX|XXX|XXXXXXXXXX');
Returns the nearest address or location to the given coordinates. A postcode or coordinates (latitude, longitude or easting, nothing) of the centre of the search.
$result = $loqate->geocoding()->ukReverseGeocode('51.4733514399,-0.00088499646');
$result = $loqate->email()->validate('foo@example.com');
$result = $loqate->bankAccount()->validate('XXXXXXXX', 'XX-XX-XX');
$result = $loqate->phone()->validate('1234567890');
$result = $loqate->phone()->validate('1234567890', 'NL');