PHP code example of ixudra / geo

1. Go to this page and download the library: Download ixudra/geo 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/ */

    

ixudra / geo example snippets



    'providers'         => array(

        //...
        Ixudra\Geo\GeoServiceProvider::class,

    ),



    'aliases'           => array(

        //...
        'Geo'               => Ixudra\Geo\Facades\Geo::class,

    ),



    use Ixudra\Geo\Facades\Geo;

    $response = Geo::geocode('Mersenhovenstraat 5, 3722 Kortessem');

    // Will return the following response:
    //
    // {
    //     "status": "success"
    //     "lat": 50.8565248
    //     "lng": 5.391962
    // }



    use Ixudra\Geo\Facades\Geo;

    $response = Geo::distance('Mersenhovenstraat 5, 3722 Wintershoven', 'Kempische Steenweg 293, 3500 Hasselt')

    // Will return the following response:
    //
    // {
    //      "status": "success"
    //      "distance": 13556       // in meters
    //      "duration": 1120        // in seconds
    // }


class_alias('Ixudra\Geo\Facades\Geo', 'Geo');