Simple searching for postcodes to retrieve geographic information. Support for various API providers and a unified address/output format.
With composer - add to your requires
section:
- "greeneh/postcode": "~0.0.1"
Add the following to your config/app.php
providers
array:
'Greeneh\Postcode\PostcodeServiceProvider',
aliases
array
'Postcode' => 'Greeneh\Postcode\Facades\Postcode',
Postcode::search('E16 1FW')
object(Greeneh\Postcode\Address)[282]
protected 'fillable' =>
array (size=6)
0 => string 'town' (length=4)
1 => string 'city' (length=4)
2 => string 'county' (length=6)
3 => string 'latitude' (length=8)
4 => string 'longitude' (length=9)
5 => string 'source' (length=6)
protected 'attributes' =>
array (size=6)
'town' => null
'city' => string 'London' (length=6)
'county' => string 'Greater London' (length=14)
'latitude' => float 51.5166391
'longitude' => float 0.0210837
'source' =>
object(stdClass)[246]
public 'results' =>
array (size=1)
0 =>
object(stdClass)[250]
public 'address_components' =>
array (size=6)
0 =>
object(stdClass)[232]
public 'long_name' => string 'E16 1FW' (length=7)
public 'short_name' => string 'E16 1FW' (length=7)
public 'types' =>
Postcode::getCoordinates('E16 1FW')
array (size=2)
'latitude' => float 51.6359841
'longitude' => float 0.2919168