Download the PHP package alexpechkarev/postcode-anywhere without Composer
On this page you can find all versions of the php package alexpechkarev/postcode-anywhere. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alexpechkarev/postcode-anywhere
More information about alexpechkarev/postcode-anywhere
Files in alexpechkarev/postcode-anywhere
Package postcode-anywhere
Short Description Laravel API wrapper for PCA Predict formerly Postcode Anywhere
License MIT
Informations about the package postcode-anywhere
Laravel API Wrapper for Loqate / PCA Predict (formerly Postcode Anywhere)
This wrapper simplifies process of making API calls to Loqate web services down to a single line of code within your Laravel application!
Dependency
This package requires the PHP cURL extension to be installed on your system.
Contents
- Installation
- Configuration
- Usage
- Detailed Example
- Support
- License
Installation
Pull in the package using Composer
composer require alexpechkarev/postcode-anywhere
Note: If you are using Laravel 5.5, the next steps are unnecessary. This package supports Laravel Package Discovery.
Include the service provider within config/app.php
.
Include the facade within config/app.php
.
Configuration
This package supports configuration.
You can publish the config file with:
When published, the config/postcodeanywhere.php
config file contains:
The configuration file has a multidimensional array called 'services' that defines web services by type; 'find' and 'retrieve'.
Feel free to add / remove any other Loqate / PCA Predict Services.
Usage
Here is an example of making call to find address records for the given postcode.
Within your application call \PA::getResponse( array $param )
with array of parameters.
Example:
Note: endpoint
is defaulted to json
when it is omitted.
Detailed Example
You could have a Service Class, for example Loqate
, and within this class you can do the heavy lifting in a __construct
or __invoke
magic method. Please find an example below:
To use the above Service class, you could do something souch as the following:
For more information, please see Loqate's API documentation PostcodeAnywhere Interactive FindByPostcode (v1.00) for required parameters and response.
Support
If you find an error or have any suggestions, please open an issue on GitHub.
License
Laravel API wrapper for Loqate / PCA Predict (formerly Postcode Anywhere) is released under the MIT License. See the bundled LICENSE file for details.