Skip to content

eski009/postcode-anywhere

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel API wrapper for PCA Predict formerly Postcode Anywhere

Build Status

This wrapper simplifies process of making API calls to PostcodeAnywhere web services. Single line of code within your Laravel application that's all it takes.

Dependency

[PHP cURL] (http://php.net/manual/en/curl.installation.php) required

Installation

To install issue following command in console

composer require alexpechkarev/postcode-anywhere:dev-master

Alternatively edit composer.json by adding following line and issue composer update command in console.

"alexpechkarev/postcode-anywhere": "dev-master"

Configuration

Once installed, register Laravel service provider, in your config/app.php:

'providers' => [
	...
    'PostcodeAnywhere\PAServiceProvider',
]

'aliases' => [
	...
    'PA' => 'PostcodeAnywhere\PAFacade' ,
]

Publish configuration file and don't forget to replace service key with your own:

    php artisan vendor:publish

Configuration file have multidimensional array 'services' that defines web services by type 'find' and 'retrieve' and store each services request path. Feel free to add / remove any other PCA Predict services.

Usage

Here is an example of making call to find address records for the given postcode. See API documentation PostcodeAnywhere Interactive FindByPostcode (v1.00) for required parameters and response.

Within your application call \PA::getResponse() with array of parameters.

Where:

$response = \PA::getRespose(
                            [
                                'find'=>'FindByPostcode', 
                                'param'=>['postcode'=>'SW1A 1AA', 'endpoint'=>'json']
                            ]);

Here is another example of retrieving full address details based on the id. See API documentation PostcodeAnywhere Interactive RetrieveById (v1.30) for required parameters and response.

Where:

$response = \PA::getRespose(
                            [
                                'retrieve'=>'RetrieveById', 
                                'param'=>['id'=>'23747212.00'] 
                            ]);

Support

Found errors or to suggest improvements please open an issue on GitHub

License

Laravel API wrapper for PCA Predict formerly Postcode Anywhere is released under the MIT License. See the bundled LICENSE file for details.

About

Laravel API wrapper for PCA Predict formerly Postcode Anywhere

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%