2017 © Pedro Peláez
 

library geo-sorter

Postcode distance sorting package for Laravel Eloquent Collections.

image

laralabs/geo-sorter

Postcode distance sorting package for Laravel Eloquent Collections.

  • Monday, June 5, 2017
  • by Laralabs
  • Repository
  • 1 Watchers
  • 1 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 180 % Grown

The README.md

Geo Sorter for Laravel

Postcode distance sorting package for Laravel Collections., (*1)

UNITED KINGDOM POSTCODES ONLY, (*2)

:rocket: Quick Start

Installation

Require the package in the composer.json of your project., (*3)

composer require laralabs/geo-sorter

Publish the configuration file., (*4)

php artisan vendor:publish --tag=geosorter-config

Edit the configuration file and set your desired settings. If you want to use a custom database table name, set it here and cache your config before moving onto the next step., (*5)

Create the postcodes table by running the following command:, (*6)

php artisan migrate

Once the database table has been created, run the following command to populate it with the latest UK Postcode District data., (*7)

php artisan geosorter:update

Usage

A helper function and facade are available, choose your preferred method. The sortByPostcode method accepts three arguments, the third argument being an optional $sort which can be used to override the sort order defined in the config., (*8)

Facade:, (*9)

<?php
$collection = Addresses::all();
$postcode   = 'B61 XYZ';

$collection = GeoSorter::sortByPostcode($collection, $postcode, 'ASC');

Helper:, (*10)

<?php
$collection = Addresses::all();
$postcode   = 'B61 XYZ';

$collection = geo_sorter()->sortByPostcode($collection, $postcode);

The above code would sort the Addresses collection in distance from the given postcode B61 XYZ., (*11)

:pushpin: Credits

Ayeo/Geo is used to calculate the distance between coordinates., (*12)

:speech_balloon: Support

Please raise an issue on GitHub if there is a problem., (*13)

:key: License

This is open-sourced software licensed under the MIT License., (*14)

The Versions

05/06 2017

dev-master

9999999-dev

Postcode distance sorting package for Laravel Eloquent Collections.

  Sources   Download

MIT License

The Requires

 

by Matt Clinton

05/06 2017

v1.0.2

1.0.2.0

Postcode distance sorting package for Laravel Eloquent Collections.

  Sources   Download

MIT License

The Requires

 

by Matt Clinton

20/03 2017

v1.0.1

1.0.1.0

Postcode distance sorting package for Laravel Eloquent Collections.

  Sources   Download

MIT License

The Requires

 

by Matt Clinton

17/03 2017

v1.0.0

1.0.0.0

Postcode distance sorting package for Laravel Eloquent Collections.

  Sources   Download

MIT License

The Requires

 

by Matt Clinton