PHPackages                             adityamenon/postcodes-io-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. adityamenon/postcodes-io-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

adityamenon/postcodes-io-laravel
================================

1.0.2(11y ago)4616[2 issues](https://github.com/adityamenon/postcodes-io-laravel/issues)MITPHPPHP &gt;=5.4.0

Since Nov 20Pushed 10y ago2 watchersCompare

[ Source](https://github.com/adityamenon/postcodes-io-laravel)[ Packagist](https://packagist.org/packages/adityamenon/postcodes-io-laravel)[ RSS](/packages/adityamenon-postcodes-io-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

ABANDONED
=========

[](#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.

PostcodesIo Laravel Package
===========================

[](#postcodesio-laravel-package)

[![Build Status](https://camo.githubusercontent.com/e702d3ec6a4a45444977e4d9e3dff4f8b180d3ac92255b352e3de575f9c98d04/68747470733a2f2f7472617669732d63692e6f72672f6164697479616d656e6f6e2f706f7374636f6465732d696f2d6c61726176656c2e7376673f6272616e63683d312e302e31)](https://travis-ci.org/adityamenon/postcodes-io-laravel)

A laravel package for querying the [postcodes.io](http://postcodes.io) web service.

Most of the Guzzle layer code was taken from @BoxUk's [Symfony bundle](https://github.com/BoxUk/postcodes-io-bundle), many props!

[License](LICENSE)

Installation
------------

[](#installation)

Installation is handled via [Composer](http://getcomposer.org).

1. Run the following command:

    ```
    $ composer require adityamenon/postcodes-io ~1.0
    ```

    This should add the following to your project's `composer.json` file:

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

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

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

Usage
-----

[](#usage)

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

Methods
-------

[](#methods)

lookup()
--------

[](#lookup)

[API documentation](http://postcodes.io/docs#Postcode-Lookup)

Lookup data about a particular postcode.

**Parameters:**

- `postcode` *(Required)*: The postcode.

**Example:**

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

bulkLookup()
------------

[](#bulklookup)

[API documentation](http://postcodes.io/docs#Bulk-Postcode-Lookup)

Lookup data about a set of postcodes.

**Parameters:**

- `postcodes` *(Required)*: An array of postcodes (max 100).

**Example:**

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

reverseGeocode()
----------------

[](#reversegeocode)

[API documentation](http://postcodes.io/docs#Geocode-Postcode)

Get data for postcodes nearest a given latitude/longitude coordinate.

**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).

**Example:**

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

bulkReverseGeocode()
--------------------

[](#bulkreversegeocode)

[API documentation](http://postcodes.io/docs#Geocode-Postcode)

Bulk translation of latitude/longitude coordinates into postcode data.

**Parameters:**

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

    - `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:**

```
$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()
----------

[](#matching)

[API documentation](http://postcodes.io/docs#Postcode-Query)

Find postcodes matching a given query.

**Parameters:**

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

**Example:**

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

validate()
----------

[](#validate)

[API documentation](http://postcodes.io/docs#Postcode-Validation)

Validate a postcode.

**Parameters:**

- `postcode` *(Required)*: The postcode to validate.

**Example:**

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

autocomplete()
--------------

[](#autocomplete)

[API documentation](http://postcodes.io/docs#Postcode-Autocomplete)

Get a list of postcodes to autocomplete a partial postcode.

**Parameters:**

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

**Example:**

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

random()
--------

[](#random)

[API documentation](http://postcodes.io/docs#Random-Postcode)

Get data for a random postcode.

**Parameters:**None.

**Example:**

```
$response = $client->random();
```

outwardCodeLookup()
-------------------

[](#outwardcodelookup)

[API documentation](http://postcodes.io/docs#Show-Outcode)

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

**Parameters:**

- `outcode` *(Required)*: The outward code (first half of postcode) to get location data for.

**Example:**

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

4190d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ac1f9d03a673a447fcf3e392a4277394cc74b31d2efd7c4c9a11c2247adaed0?d=identicon)[adityamenon](/maintainers/adityamenon)

---

Top Contributors

[![adityamenon](https://avatars.githubusercontent.com/u/640815?v=4)](https://github.com/adityamenon "adityamenon (16 commits)")

### Embed Badge

![Health badge](/badges/adityamenon-postcodes-io-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/adityamenon-postcodes-io-laravel/health.svg)](https://phpackages.com/packages/adityamenon-postcodes-io-laravel)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
