Skip to content

Latest commit

 

History

History
executable file
·
54 lines (36 loc) · 1.34 KB

README.md

File metadata and controls

executable file
·
54 lines (36 loc) · 1.34 KB

Google Distance in Laravel

StyleCI Quality Score

Requirements

  • PHP >= 7.1.3
  • Laravel >= 5.5.*

Installation

Require this package with composer.

composer require pnlinh/laravel-google-distance

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

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

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

GOOGLE_MAPS_DISTANCE_API_KEY=ThisIsMyGoogleApiKey
GOOGLE_MAPS_DISTANCE_UNITS=ThisIsUnits

Usage

// Use Facades
use Pnlinh\GoogleDistance\Facades\GoogleDistance;

$distance = GoogleDistance::calculate('FromAddress', 'To Address');

// Use Helper Function
$distance = google_distance('From Address', 'To Address');

Test

composer test

Credits

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