greeneh / postcode
There is no license information available for the latest version (0.0.1) of this package.
Unified search for postcodes across various different providers.
0.0.1
2014-09-24 08:31 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- mockery/mockery: 0.9.*@dev
This package is auto-updated.
Last update: 2024-11-14 03:20:15 UTC
README
Simple searching for postcodes to retrieve geographic information. Support for various API providers and a unified address/output format.
Installation
With composer - add to your requires
section:
- "greeneh/postcode": "~0.0.1"
Laravel Specific
Add the following to your config/app.php
providers
array:
'Greeneh\Postcode\PostcodeServiceProvider',
aliases
array
'Postcode' => 'Greeneh\Postcode\Facades\Postcode',
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