Download the PHP package academe/idealpostcodes without Composer

On this page you can find all versions of the php package academe/idealpostcodes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package idealpostcodes

IdealPostcodes

Latest Stable Version Total Downloads

Library to access the Ideal Postcodes API. The main documentation for the API is here: https://ideal-postcodes.co.uk/documentation

Still much work-in-progress, but a working library. This package is not associated officially with Ideal Postcodes.

General Approach

This is the general approach I have taken in developing this library. It was all initially written in one day to meet a need for a specific project, so may be a bit rushed, but I have tried to keep it as generic as possible. It does need extending out with more interfaces though, and perhaps make the most of a DI locator so classes can be extended as needed.

Communication with the remote API happens in the Transport object. Instantiate that with your API key and pass that into the other classes. This class uses curl to communicate, but you may want to create a guzzle version or use a different http client - just write an adapter and you should be good.

Each value class searves two purposes:

So if you want to find, for example, addresses for a postcode, instantiate the Postcode object then use its getAddresses($postcode) method to fetch a collection of Address objects for a postcode. The Postcode object will hold the summary of the interaction with the API (the result, any messages etc) while the getAddresses() method will return a collection.

The collections are provided by the phpcollection/phpcollection composer package. This is a new and largely untested package, but seemed to meet the needs here nicely. I intend to make the collections more generic in the future, so you are not tied down to just one collections implementation.

Examples

Example use, to fetch a list of addresses matching a postcode:

use Academe\IdealPostcodes\Postcode;
use Academe\IdealPostcodes\Transport;

// 'iddqd' is the shared developer API key, limited to 15 requests per day for each IP address.
$transport = new Transport('iddqd');
$postcode = new Postcode($transport);

$addresses = $postcode->getAddresses('ID1 1QD');

foreach($addresses as $address) {
    echo $address->line_1 . "<br>";
}

echo "Number of addresses = " . count($addresses);

Get up to 20 postcodes in a 300m radius around a latitude/longitude location:

use Academe\IdealPostcodes\GeoLocation;
use Academe\IdealPostcodes\Transport;

$transport = new Transport('iddqd');
$geo = new GeoLocation($transport);

$postcodes = $geo->getPostcodes(-0.20864436, 51.48994883, 20, 300);

foreach($postcodes as $postcode) {
    echo $postcode->postcode . "<br>";
    echo $postcode->northings . "<br>";
    echo $postcode->eastings . "<br>";
}

echo "Number of postcodes = " . count($postcodes);

Search for addresses:

use Academe\IdealPostcodes\Address;
use Academe\IdealPostcodes\Transport;

$transport = new Transport('iddqd');
$addr = new Address($transport);

$addresses = $addr->search('10 Downing Street');

foreach($addresses as $address) {
    echo $postcode->town . "<br>";
}

Get a single address by its ID (UDPRN):

use Academe\IdealPostcodes\Address;
use Academe\IdealPostcodes\Transport;

$transport = new Transport('iddqd');
$addr = new Address($transport);

$address = $addr->get(0);

var_dump($address->toArray());

TODO


All versions of idealpostcodes with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-json Version *
phpcollection/phpcollection Version ^0.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package academe/idealpostcodes contains the following files

Loading the files please wait ....