2017 © Pedro Peláez
 

library postcodes-io-laravel

image

muzzaopencopy/postcodes-io-laravel

  • Thursday, February 18, 2016
  • by murrayopencopy
  • Repository
  • 2 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

PostcodesIo Laravel Package

This is a fork of chadanuk/postcodes-io-laravel., (*1)

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

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

License, (*4)

Installation

Installation is handled via Composer., (*5)

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

    $ composer require muzzaopencopy/postcodes-io dev-master
    

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

    "require": {
        "muzzaopencopy/postcodes-io-laravel": "dev-master"
    }
    
  2. Add the Service Provider to your app/config/app.php file:, (*8)

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

    'aliases' => array('PostcodesIo' => 'MuzzaOpenCopy\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')., (*10)

Methods

lookup()

API documentation, (*11)

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

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

Example:, (*14)

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

bulkLookup()

API documentation, (*15)

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

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

Example:, (*18)

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

reverseGeocode()

API documentation, (*19)

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

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)., (*21)

Example:, (*22)

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

bulkReverseGeocode()

API documentation, (*23)

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

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

* `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:, (*26)

$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, (*27)

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

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

Example:, (*30)

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

validate()

API documentation, (*31)

Validate a postcode., (*32)

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

Example:, (*34)

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

autocomplete()

API documentation, (*35)

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

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

Example:, (*38)

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

random()

API documentation, (*39)

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

Parameters: None., (*41)

Example:, (*42)

$response = $client->random();

outwardCodeLookup()

API documentation, (*43)

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

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

Example:, (*46)

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

The Versions

18/02 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Murray

25/04 2015

2.1

2.1.0.0

  Sources   Download

MIT

The Requires

 

by Avatar chadanuk

21/04 2015

2.0

2.0.0.0

  Sources   Download

MIT

The Requires

 

by Avatar chadanuk

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