PHP code example of programic / laravel-distance-matrix

1. Go to this page and download the library: Download programic/laravel-distance-matrix 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/ */

    

programic / laravel-distance-matrix example snippets


use \Programic\DistanceMatrix\DistanceMatrix

class DistanceController {

    public function index(DistanceMatrix $distanceMatrix)
    {
        $response = $distanceMatrix->from($from)->to($to)->calculate();
        
        $distance = $response->toArray();
    }
    
} 

use Programic\DistanceMatrix\Exceptions\InvalidKeyException;
use Programic\DistanceMatrix\Exceptions\InvalidRequestException;
use Programic\DistanceMatrix\Exceptions\MaxDimensionsExceededException;
use Programic\DistanceMatrix\Exceptions\MaxElementsExceededException;
use Programic\DistanceMatrix\Exceptions\OverDailyLimitException;
use Programic\DistanceMatrix\Exceptions\OverQueryLimitException;
use Programic\DistanceMatrix\Exceptions\RequestDeniedException;
use Programic\DistanceMatrix\Exceptions\UnknownErrorException;