PHP code example of laralabs / geo-sorter

1. Go to this page and download the library: Download laralabs/geo-sorter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laralabs / geo-sorter example snippets



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

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


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

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

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

php artisan migrate

php artisan geosorter:update