flarone/google-matrix-api

Wrapper for the Google Distance Matrix API (and Laravel friendly)

1.0.4 2023-03-18 20:41 UTC

This package is auto-updated.

Last update: 2024-10-18 23:52:20 UTC


README

Requirements

  • PHP >= 7.1.3, >= 8.0.*, >= 8.1.*, >= 8.2.*
  • Laravel >= 5.5.*, 6.*, 7.*, 8.*, 9.*, 10.*

Installation

Require this package with composer.

composer require flarone/google-matrix-api

To publishes config config/google-matrix-api.php, use command:

php artisan vendor:publish --tag="google-matrix"

You must set your Google Maps API Key GOOGLE_MAPS_MATRIX_API_KEY in your .env file like so:

GOOGLE_MAPS_MATRIX_API_KEY=ThisIsMyGoogleApiKey

Usage

// Use Facades
use Flarone\GoogleMatrix\Facades\GoogleMatrix;

$matrix = GoogleMatrix::calculate('FromAddress', 'To Address');

// Use Helper Function
$matrix = google_matrix('From Address', 'To Address');

Test

composer test

Credits

For more info, please visit https://developers.google.com/maps/documentation/distance-matrix/