programic / laravel-distance-matrix
Using Google Distance Matrix in Laravel
Installs: 4 300
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^7.0|^8.0
- laravel/framework: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
README
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 info@programic.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.