Download the PHP package davit37/php-google-maps-distance-matrix without Composer
On this page you can find all versions of the php package davit37/php-google-maps-distance-matrix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davit37/php-google-maps-distance-matrix
More information about davit37/php-google-maps-distance-matrix
Files in davit37/php-google-maps-distance-matrix
Package php-google-maps-distance-matrix
Short Description PHP Implementation of the Google Maps Distance Matrix API
License MIT
Informations about the package php-google-maps-distance-matrix
PHP Google Maps Distance Matrix API
This is a simple package that allows access to the Google Maps Distance Matrix API using a (mostly) fluent API. There is support for both the Standard License and Premium/Enterprise License types provided by Google.
Installation
Install the package using composer:
add repositories to composer.json
add packet to composer.json
Frameworks
At the moment we only have framework compatibility for Laravel. However, we welcome PRs to add further framework specific behavior as long as it doesn't prevent the package working for others, or pull in dependencies that are not optional (suggested).
Laravel
If you are using Laravel then you can use our service provider. If you have Laravel >5.5 then the package
will be auto discovered upon install. Else, add the following to your config/app.php
file:
Facades
Personally, I hate facades. However, I know people like them. If you are using Laravel >5.5 then the facade will
be automatically discovered. Else, you can add it in your config/app.php
file.
Configuration
First, make sure you have copied the configuration file:
This will make a config/google.php
file, this is where your API Key / License information is fetched from.
By default we use the .env
configuration values to get your API key.
If you have a standard api key all you need to add to your .env
is:
If you are a Premium / Enterprise Google Maps user, and use a encryption key and client ID then you should add
the following to your .env
:
Please, make sure you don't store your keys in version control!
Usage
License / API Key
Before making requests you need to create your License object. If you are a standard google maps user, then all you will need is your API key, then you can create your license as follows:
If you are a Premium / Enterprise google maps user, then you need to create your license as follows:
Then, you can start making your request: