library postcode
Unified search for postcodes across various different providers.
greeneh/postcode
Unified search for postcodes across various different providers.
- Wednesday, September 24, 2014
- by garygreen
- Repository
- 1 Watchers
- 8 Stars
- 33 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Postcode Search
Simple searching for postcodes to retrieve geographic information. Support for various API providers and a unified address/output format., (*1)
Installation
With composer - add to your requires section:, (*2)
- "greeneh/postcode": "~0.0.1"
Laravel Specific
Add the following to your config/app.php, (*3)
-
providers array:, (*4)
'Greeneh\Postcode\PostcodeServiceProvider',, (*5)
-
aliases array, (*6)
'Postcode' => 'Greeneh\Postcode\Facades\Postcode',, (*7)
Usage
Retrieving geograhic information from a postcode:
Postcode::search('E16 1FW')
Result from using the Google API Provider
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' =>
Get the lat/lng from a postcode
Postcode::getCoordinates('E16 1FW')
Result
array (size=2)
'latitude' => float 51.6359841
'longitude' => float 0.2919168
dev-master
9999999-dev
Unified search for postcodes across various different providers.
Sources
Download
The Requires
The Development Requires
by
Gary Green
0.0.1
0.0.1.0
Unified search for postcodes across various different providers.
Sources
Download
The Requires
The Development Requires
by
Gary Green