2017 © Pedro Peláez
 

library postcodes-io-laravel

image

adityamenon/postcodes-io-laravel

  • Monday, December 7, 2015
  • by adityamenon
  • Repository
  • 2 Watchers
  • 4 Stars
  • 44 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 2 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

ABANDONED

Sorry, if you've come here looking for updates, I regret to inform that this package has now been abandoned. Please ping me @codeisawesome on twitter if you need something urgent to updated here. Forking and updating it, however, is a better idea., (*1)

PostcodesIo Laravel Package

Build Status, (*2)

A laravel package for querying the postcodes.io web service., (*3)

Most of the Guzzle layer code was taken from @BoxUk's Symfony bundle, many props!, (*4)

License, (*5)

Installation

Installation is handled via Composer., (*6)

  1. Run the following command:, (*7)

    $ composer require adityamenon/postcodes-io ~1.0
    

    This should add the following to your project's composer.json file:, (*8)

    "require": {
        "adityamenon/postcodes-io": "~1.0"
    }
    
  2. Add the Service Provider to your app/config/app.php file:, (*9)

    'providers' => array('Adityamenon\PostcodesIo\PostcodesIoServiceProvider')
    
  3. Add the Facade in the same file:, (*10)

    'aliases' => array('PostcodesIo' => 'Adityamenon\PostcodesIo\Facade')
    

Usage

Use the PostcodesIo facade with any of the methods below to get data from the service. For example: PostcodesIo::lookup('CF10 1DD')., (*11)

Methods

lookup()

API documentation, (*12)

Lookup data about a particular postcode., (*13)

Parameters: * postcode (Required): The postcode., (*14)

Example:, (*15)

$response = $client->lookup(array('postcode' => 'CF10 1DD'));

bulkLookup()

API documentation, (*16)

Lookup data about a set of postcodes., (*17)

Parameters: * postcodes (Required): An array of postcodes (max 100)., (*18)

Example:, (*19)

$response = $client->bulkLookup(array('postcodes' => array('CF10 1DD', 'W1B 4BD'));

reverseGeocode()

API documentation, (*20)

Get data for postcodes nearest a given latitude/longitude coordinate., (*21)

Parameters: * latitude (Required): The latitude. * longitude (Required): The longitude. * limit (Optional): The maximum number of postcodes to return (default 10, max 100). * radius (Optional): The radius in metres in which to find postcodes (default 100, max 1000)., (*22)

Example:, (*23)

$response = $client->reverseGeocode(array('latitude' => 51.481667, 'longitude' => -3.182155);

bulkReverseGeocode()

API documentation, (*24)

Bulk translation of latitude/longitude coordinates into postcode data., (*25)

Parameters: * geolocations (Required): The geolocations to look up (maximum 100). This parameter should be an array, each element with the following keys:, (*26)

* `latitude` _(Required)_: The latitude.
* `longitude` _(Required)_: The longitude.
* `limit` _(Optional)_: The maximum number of postcodes to return (default 10, max 100).
* `radius` _(Optional)_: The radius in metres in which to find postcodes (default 100, max 1000).

Example:, (*27)

$response = $client->bulkReverseGeocode(
    array(
        'geolocations' => array(
            array('latitude' => 51.481667, 'longitude' => -3.182155),
            array('latitude' => 51.88328, 'longitude' => -3.43684, 'limit' => 5, 'radius' => 500)
        )
    )
);

matching()

API documentation, (*28)

Find postcodes matching a given query., (*29)

Parameters: * query (Optional): The postcode query, e.g. 'CF10'. * limit (Optional): The maximum number of postcodes to return (default 10, max 100)., (*30)

Example:, (*31)

$response = $client->matching(array('query' => 'CF10', 'limit' => 20);

validate()

API documentation, (*32)

Validate a postcode., (*33)

Parameters: * postcode (Required): The postcode to validate., (*34)

Example:, (*35)

$response = $client->validate(array('postcode' => 'CF10 1DD');

autocomplete()

API documentation, (*36)

Get a list of postcodes to autocomplete a partial postcode., (*37)

Parameters: * postcode (Required): The postcode to autocomplete. * limit (Optional): The maximum number of postcodes to return (default 10, max 100)., (*38)

Example:, (*39)

$response = $client->autocomplete(array('postcode' => 'CF10', 'limit' => 20);

random()

API documentation, (*40)

Get data for a random postcode., (*41)

Parameters: None., (*42)

Example:, (*43)

$response = $client->random();

outwardCodeLookup()

API documentation, (*44)

Get data for the specified "outward code" (first half of postcode)., (*45)

Parameters: * outcode (Required): The outward code (first half of postcode) to get location data for., (*46)

Example:, (*47)

$response = $client->outwardCodeLookup(array('outcode' => 'CF10');

The Versions

07/12 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by aditya menon

22/11 2014

1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

by aditya menon

20/11 2014

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

by aditya menon

20/11 2014

1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by aditya menon