LaravelPackages.net
Acme Inc.
Toggle sidebar
programic/laravel-distance-matrix

Using Google Distance Matrix in Laravel

8.891
0
v1.2.0
About programic/laravel-distance-matrix

programic/laravel-distance-matrix is a Laravel package for using google distance matrix in laravel. It currently has 0 GitHub stars and 8.891 downloads on Packagist (latest version v1.2.0). Install it with composer require programic/laravel-distance-matrix. Discover more Laravel packages by programic or browse all Laravel packages to compare alternatives.

Last updated

Programic - Google Distance matrix

Latest Version on Packagist Total Downloads

This package allows you to use get simple the duration and distance between two addresses by the Google Distance Matrix API

Installation

This package requires PHP 7.2 and Laravel 5.8 or higher.

composer require programic/laravel-distance-matrix

Basic Usage

use \Programic\DistanceMatrix\DistanceMatrix

class DistanceController {

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

Available Exceptions

See the Exceptions folder for more information. Except for the InvalidKeyException, these Exceptions are all taken from the Google Distance Matrix API documentation.

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;

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Star History Chart