New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

lodge/postcode-lookup

A postcode lookup utility using the Google Maps API, ready to use with Laravel 5.
31,603 34

Larablocks Analysis

lodge/postcode-lookup works with Laravel 4 to 9 (latest release 0.8.0, Feb 11, 2022), all past end of life (the last on Feb 6, 2024): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 4 to 9, past end of life since Feb 6, 2024
  • No release in the last 12 months (last: Feb 11, 2022)
  • 152 downloads a month (needs 10,000)
  • 34 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Feb 11, 2022.
  • No releases in the last 12 months.
  • First released: Aug 2, 2013.
  • Monthly downloads: 152, down 16% from six months ago.
  • 4 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require lodge/postcode-lookup
Latest Version:0.8.0
PHP:>=7.4
Laravel:4 – 9
License:MIT
Last Updated:Mar 24, 2024
Links: GitHub  ·  Packagist
Maintainer: daursu

Postcode Lookup

Latest Stable Version Total Downloads Latest Unstable Version License

PHP library that performs a postcode lookup using Google Maps API.

Compatible with Laravel 4-8.

Quick start

First of all you need to require the package inside your composer.json file:

{
    "require": {
        "lodge/postcode-lookup": "0.7.0"
    }
}

Note: for Laravel 4 use version 0.3.0

Register with Laravel

Register the service provider. Inside your app.php config file add:

'providers' => array(
	...
	'Lodge\Postcode\PostcodeServiceProvider',
)

A facade is also provided, so in order to register it add the following to your app.php config file:

'aliases' => array(
	...
	'Postcode' => 'Lodge\Postcode\Facades\Postcode',
);

Publish the configuration file.

php artisan vendor:publish --provider="Lodge\Postcode\PostcodeServiceProvider"

Set your Google API key inside config/postcode.php file.

Usage with Laravel

From within your controller you can call:

	$postcode = Postcode::lookup('SW3 4SZ');

	print_r($postcode);

	// Outputs
	array(
		'postcode'      => 'SW34SZ',
		'street_number' => '',
		'street'        => '',
		'sublocality'   => '',
		'town'          => 'London',
		'county'        => 'Greater London',
		'country'       => 'United Kingdom',
		'latitude'      => 51.489117499999999,
		'longitude'     => -0.1579016
	);
Get the Latitude and Longitude of an address
	$coordinates = Postcode::getCoordinates($address);

	print_r($coordinates);

	// Outputs
	array(
		'latitude'  => 1.521231
		'longitude' => -23.012123
	)

Usage outside of Laravel

	// First of all you need to instantiate the class
	// And assuming that you have required the composer
	// autoload.php file
	require 'vendor/autoload.php';

    $googleApiKey = 'your-google-api-key';
	$postcode = new Lodge\Postcode\Postcode($googleApiKey);
	$results = $postcode->lookup('SW3 4SZ');

	print_r($results);

	// Outputs
	array(
		'postcode'      => 'SW34SZ',
		'street_number' => '',
		'street'        => '',
		'sublocality'   => '',
		'town'          => 'London',
		'county'        => 'Greater London',
		'country'       => 'United Kingdom',
		'latitude'      => 51.489117499999999,
		'longitude'     => -0.1579016
	)

If you need to get just the latitude and longitude for an address you can use:

    $googleApiKey = 'your-google-api-key';
	$postcode = new Lodge\Postcode\Postcode($googleApiKey);
	$results = $postcode->getCoordinates('SW3 4SZ');

	print_r($results);

	// Outputs
	array(
		'latitude'  => 51.489117499999999
		'longitude' => -0.1579016
	)

Changelog

  • Version 0.7

    • Added support for Laravel 8
  • Version 0.6

    • Added support for Laravel 7
  • Version 0.4

    • Added configuration file and the ability to set the Google API key.
    • Updated namespaces to PSR-4
    • Added test stubs.
    • Dropped support for Laravel 4.
  • Version 0.3

    • Removed deprecated bind call and instantiate as a singleton instead.
  • Version 0.2

    • Laravel 5 compatible
    • Fixed facade namespace, that would not adhere to PSR-0
    • Updated documentation
  • Version 0.1

    • Initial Release

License

The MIT License (MIT)

Copyright (c) 2013-2015 Dan Ursu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
0.8.0 >=7.4 4.x|~5.0|^6.0|^7.0|^8.0|^9.0 MIT
0.7.0 >=5.4.0 4.x|~5.0|^6.0|^7.0|^8.0 MIT
0.6.0 >=5.4.0 4.x|~5.0|^6.0|^7.0 MIT
0.5.0 >=5.4.0 4.x|~5.0 MIT
0.4.1 >=5.4.0 4.x|~5.0 MIT