Download the PHP package moova/google-maps without Composer
On this page you can find all versions of the php package moova/google-maps. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download moova/google-maps
More information about moova/google-maps
Files in moova/google-maps
Package google-maps
Short Description Collection of Google Maps API Web Services for Laravel
License MIT
Informations about the package google-maps
Collection of Google Maps API Web Services for Laravel
Provides convenient way of setting up and making requests to Maps API from Laravel application. For services documentation, API key and Usage Limits visit Google Maps API Web Services and Maps API for Terms of Service License Restrictions.
Features
- Directions API
- Distance Matrix API
- Elevation API
- Geocoding API
- Geolocation API
- Roads API
- Time Zone API
- Places API Web Services
Dependency
Notes
Rmoving Place Add, Delete & Radar Search features
Requests to the Places API attempting to use these features will receive an error response
- Place Add
- Place Delete
- Radar Search
Deprication notices for Google Places API Web Service that effects Premium data (Zagat), types parameter, id and reference fields.
- Nearby Search -
types
parameter depricated, use parametertype
(string) - Place Details - the
reference
is now deprecated in favor ofplaceid
(placeid
originally used in this package) - Place Add - still uses
types
parameter as per service documentation - Place Autocomplete - still uses
types
parameter as per service documentation
Installation
Issue following command in console:
For laravel 6 use 6.0
.
Alternatively edit composer.json by adding following line and run composer update
Configuration
Register package service provider and facade in 'config/app.php'
Publish configuration file using php artisan vendor:publish --tag=googlemaps
or simply copy package configuration file and paste into config/googlemaps.php
Open configuration file config/googlemaps.php
and add your service key
If you like to use different keys for any of the services, you can overwrite master API Key by specifying it in the service
array for selected web service.
Alternatively, you can set an API KEY with the method setKey
.
Usage
Here is an example of making request to Geocoding API:
By default, where appropriate, output
parameter set to JSON
. Don't forget to decode JSON string into PHP variable.
See Processing Response for more details on parsing returning output.
Required parameters can be specified as an array of key:value
pairs:
Alternatively parameters can be set using setParamByKey()
method. For deeply nested array use "dot" notation as per example below.
Another example showing request to Places API Place Add service:
Available methods
load( $serviceName )
setEndpoint( $endpoint )
getEndpoint()
setParamByKey( $key, $value)
setParam( $parameters)
setKey( $key )
get()
get( $key )
containsLocation( $lat, $lng )
isLocationOnEdge( $lat, $lng, $tolrance)
load( $serviceName )
- load web service by name
Accepts string as parameter, web service name as specified in configuration file. Returns reference to it's self.
setEndpoint( $endpoint )
- set request output
Accepts string as parameter, json
or xml
, if omitted defaulted to json
.
Returns reference to it's self.
getEndpoint()
- get current request output
Returns string.
setParamByKey( $key, $value )
- set request parameter using key:value pair
Accepts two parameters:
key
- body parameter namevalue
- body parameter value
Deeply nested array can use 'dot' notation to assign value. Returns reference to it's self.
setParam( $parameters)
- set all request parameters at once
Accepts array of parameters Returns reference to it's self.
setKey( $key )
- set a specific service key
Accepts a string as service key Returns reference to it's self.
get()
- perform web service request (irrespectively to request type POST or GET )get( $key )
- accepts string response body key, use 'dot' notation for deeply nested array
Returns web service response in the format specified by setEndpoint()
method, if omitted defaulted to JSON
.
Use json_decode()
to convert JSON string into PHP variable. See Processing Response for more details on parsing returning output.
Example with $key
parameter
isLocationOnEdge( $lat, $lng, $tolrance = 0.1 )
- To determine whether a point falls on or near a polyline, or on or near the edge of a polygon, pass the point, the polyline/polygon, and optionally a tolerance value in degrees.
This method only available with Google Maps Directions API.
Accepted parameter:
$lat
- double latitude$lng
- double longitude$tolrance
- double
containsLocation( $lat, $lng )
-To find whether a given point falls within a polygon.
This method only available with Google Maps Directions API.
Accepted parameter:
$lat
- double latitude$lng
- double longitude
Support
Please open an issue on GitHub
License
Collection of Google Maps API Web Services for Laravel is released under the MIT License. See the bundled LICENSE file for details.
All versions of google-maps with dependencies
jbroadway/urlify Version ^1.1
ext-json Version *
ext-curl Version *