PHPackages                             ivand4re/google-maps-lumen-v9 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ivand4re/google-maps-lumen-v9

ActiveLibrary[API Development](/categories/api)

ivand4re/google-maps-lumen-v9
=============================

Collection of Google Maps API Web Services for Laravel

01PHP

Since Dec 13Pushed 3y agoCompare

[ Source](https://github.com/IvanD4RE/google-maps-lumen-v9)[ Packagist](https://packagist.org/packages/ivand4re/google-maps-lumen-v9)[ RSS](/packages/ivand4re-google-maps-lumen-v9/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Collection of Google Maps API Web Services for Laravel
------------------------------------------------------

[](#collection-of-google-maps-api-web-services-for-laravel)

Provides convenient way of setting up and making requests to Maps API from [Laravel](http://laravel.com/) application. For services documentation, API key and Usage Limits visit [Google Maps API Web Services](https://developers.google.com/maps/documentation/webservices/) and [Maps API for Terms of Service License Restrictions](https://developers.google.com/maps/terms#section_10_12).

Features
--------

[](#features)

- [Directions API](https://developers.google.com/maps/documentation/directions/)
- [Distance Matrix API](https://developers.google.com/maps/documentation/distance-matrix/)
- [Elevation API](https://developers.google.com/maps/documentation/elevation/)
- [Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
- [Geolocation API](https://developers.google.com/maps/documentation/geolocation/)
- [Roads API](https://developers.google.com/maps/documentation/roads/)
- [Time Zone API](https://developers.google.com/maps/documentation/timezone/)
- [Places API Web Services](https://developers.google.com/places/web-service/)

Dependency
----------

[](#dependency)

- [PHP cURL](http://php.net/manual/en/curl.installation.php)
- [PHP &gt;= 7.3.0](http://php.net/)

Notes
-----

[](#notes)

[Rmoving Place Add, Delete &amp; Radar Search features](https://cloud.google.com/blog/products/maps-platform/announcing-deprecation-of-place-add)

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 parameter **`type`** (string)
- Place Details - the **`reference`** is now deprecated in favor of **`placeid`** (**`placeid`** originally used in this package)
- Place Add - still uses **`types`** parameter as per [service documentation](https://developers.google.com/places/web-service/add-place)
- Place Autocomplete - still uses **`types`** parameter as per [service documentation](https://developers.google.com/places/web-service/autocomplete)

Installation
------------

[](#installation)

Issue following command in console:

For laravel 6 use `6.0`.

```
composer require alexpechkarev/google-maps
```

Alternatively edit composer.json by adding following line and run **`composer update`**

```
"require": {
		....,
		"alexpechkarev/google-maps":"^8.0",

	},
```

Configuration
-------------

[](#configuration)

Register package service provider and facade in 'config/app.php'

```
'providers' => [
    ...
    GoogleMaps\ServiceProvider\GoogleMapsServiceProvider::class,
]

'aliases' => [
    ...
    'GoogleMaps' => GoogleMaps\Facade\GoogleMapsFacade::class,
]
```

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

```
    /*
    |----------------------------------
    | Service Keys
    |------------------------------------
    */

    'key'       => 'ADD YOUR SERVICE KEY HERE',
```

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.

Usage
-----

[](#usage)

Here is an example of making request to Geocoding API:

```
$response = \GoogleMaps::load('geocoding')
		->setParam (['address' =>'santa cruz'])
 		->get();
```

By default, where appropriate, `output` parameter set to `JSON`. Don't forget to decode JSON string into PHP variable. See [Processing Response](https://developers.google.com/maps/documentation/webservices/#Parsing) for more details on parsing returning output.

Required parameters can be specified as an array of `key:value` pairs:

```
$response = \GoogleMaps::load('geocoding')
		->setParam ([
		    'address'    =>'santa cruz',
         	    'components' => [
                     	'administrative_area'  => 'TX',
                     	'country'              => 'US',
                      ]

                ])
                ->get();
```

Alternatively parameters can be set using `setParamByKey()` method. For deeply nested array use "dot" notation as per example below.

```
$endpoint = \GoogleMaps::load('geocoding')
   ->setParamByKey('address', 'santa cruz')
   ->setParamByKey('components.administrative_area', 'TX') //return $this
    ...
```

Another example showing request to Places API Place Add service:

```
$response = \GoogleMaps::load('placeadd')
                ->setParam([
                   'location' => [
                        'lat'  => -33.8669710,
                        'lng'  => 151.1958750
                      ],
                   'accuracy'           => 0,
                   "name"               =>  "Google Shoes!",
                   "address"            => "48 Pirrama Road, Pyrmont, NSW 2009, Australia",
                   "types"              => ["shoe_store"],
                   "website"            => "http://www.google.com.au/",
                   "language"           => "en-AU",
                   "phone_number"       =>  "(02) 9374 4000"
                          ])
                  ->get();
```

Available methods
-----------------

[](#available-methods)

- [`load( $serviceName )`](#load)
- [`setEndpoint( $endpoint )`](#setEndpoint)
- [`getEndpoint()`](#getEndpoint)
- [`setParamByKey( $key, $value)`](#setParamByKey)
- [`setParam( $parameters)`](#setParam)
- [`get()`](#get)
- [`get( $key )`](#get)
- [`containsLocation( $lat, $lng )`](#containsLocation)
- [`isLocationOnEdge( $lat, $lng, $tolrance)`](#isLocationOnEdge)

---

**`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.

```
\GoogleMaps::load('geocoding')
...
```

---

**`setEndpoint( $endpoint )`** - set request output

Accepts string as parameter, `json` or `xml`, if omitted defaulted to `json`. Returns reference to it's self.

```
$response = \GoogleMaps::load('geocoding')
		->setEndpoint('json')  // return $this
		...
```

---

**`getEndpoint()`** - get current request output

Returns string.

```
$endpoint = \GoogleMaps::load('geocoding')
		->setEndpoint('json')
		->getEndpoint();

echo $endpoint; // output 'json'
```

---

**`setParamByKey( $key, $value )`** - set request parameter using key:value pair

Accepts two parameters:

- `key` - body parameter name
- `value` - body parameter value

Deeply nested array can use 'dot' notation to assign value. Returns reference to it's self.

```
$endpoint = \GoogleMaps::load('geocoding')
   ->setParamByKey('address', 'santa cruz')
   ->setParamByKey('components.administrative_area', 'TX') //return $this
    ...
```

---

**`setParam( $parameters)`** - set all request parameters at once

Accepts array of parameters Returns reference to it's self.

```
$response = \GoogleMaps::load('geocoding')
                ->setParam([
                   'address'     => 'santa cruz',
                   'components'  => [
                        'administrative_area'   => 'TX',
                        'country'               => 'US',
                         ]
                     ]) // return $this
...
```

---

- **`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](https://developers.google.com/maps/documentation/webservices/#Parsing) for more details on parsing returning output.

```
$response = \GoogleMaps::load('geocoding')
                ->setParamByKey('address', 'santa cruz')
                ->setParamByKey('components.administrative_area', 'TX')
                 ->get();

var_dump( json_decode( $response ) );  // output

/*
{\n
   "results" : [\n
      {\n
         "address_components" : [\n
            {\n
               "long_name" : "277",\n
               "short_name" : "277",\n
               "types" : [ "street_number" ]\n
            },\n
            ...
*/
```

Example with `$key` parameter

```
$response = \GoogleMaps::load('geocoding')
                ->setParamByKey('latlng', '40.714224,-73.961452')
                 ->get('results.formatted_address');

var_dump( json_decode( $response ) );  // output

/*
array:1 [▼
  "results" => array:9 [▼
    0 => array:1 [▼
      "formatted_address" => "277 Bedford Ave, Brooklyn, NY 11211, USA"
    ]
    1 => array:1 [▼
      "formatted_address" => "Grand St/Bedford Av, Brooklyn, NY 11211, USA"
    ]
            ...
*/
```

---

**`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

```
$response = \GoogleMaps::load('directions')
            ->setParam([
                'origin'          => 'place_id:ChIJ685WIFYViEgRHlHvBbiD5nE',
                'destination'     => 'place_id:ChIJA01I-8YVhkgRGJb0fW4UX7Y',
            ])
           ->isLocationOnEdge(55.86483,-4.25161);

    dd( $response  );  // true
```

---

**`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

```
$response = \GoogleMaps::load('directions')
            ->setParam([
                'origin'          => 'place_id:ChIJ685WIFYViEgRHlHvBbiD5nE',
                'destination'     => 'place_id:ChIJA01I-8YVhkgRGJb0fW4UX7Y',
            ])
           ->containsLocation(55.86483,-4.25161);

    dd( $response  );  // true
```

Support
-------

[](#support)

[Please open an issue on GitHub](https://github.com/alexpechkarev/google-maps/issues)

License
-------

[](#license)

Collection of Google Maps API Web Services for Laravel is released under the MIT License. See the bundled [LICENSE](https://github.com/alexpechkarev/google-maps/blob/master/LICENSE)file for details.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fcda970a8d302fbb127e9640045a93acdfb106e98170aa4ce44d7e0e089c0b8?d=identicon)[d4re](/maintainers/d4re)

---

Top Contributors

[![alexpechkarev](https://avatars.githubusercontent.com/u/5559162?v=4)](https://github.com/alexpechkarev "alexpechkarev (120 commits)")[![markwalet](https://avatars.githubusercontent.com/u/11446771?v=4)](https://github.com/markwalet "markwalet (12 commits)")[![fa2mm](https://avatars.githubusercontent.com/u/3799461?v=4)](https://github.com/fa2mm "fa2mm (3 commits)")[![ndrd](https://avatars.githubusercontent.com/u/8826286?v=4)](https://github.com/ndrd "ndrd (2 commits)")[![vesper8](https://avatars.githubusercontent.com/u/816028?v=4)](https://github.com/vesper8 "vesper8 (2 commits)")[![repat](https://avatars.githubusercontent.com/u/516807?v=4)](https://github.com/repat "repat (2 commits)")[![gart77](https://avatars.githubusercontent.com/u/13002423?v=4)](https://github.com/gart77 "gart77 (2 commits)")[![parkourben99](https://avatars.githubusercontent.com/u/7295774?v=4)](https://github.com/parkourben99 "parkourben99 (2 commits)")[![neoteknic](https://avatars.githubusercontent.com/u/1809652?v=4)](https://github.com/neoteknic "neoteknic (1 commits)")[![nmfzone](https://avatars.githubusercontent.com/u/10361906?v=4)](https://github.com/nmfzone "nmfzone (1 commits)")[![Syrok](https://avatars.githubusercontent.com/u/124498?v=4)](https://github.com/Syrok "Syrok (1 commits)")[![xeader](https://avatars.githubusercontent.com/u/1153759?v=4)](https://github.com/xeader "xeader (1 commits)")[![brianrlewis](https://avatars.githubusercontent.com/u/31142584?v=4)](https://github.com/brianrlewis "brianrlewis (1 commits)")[![cyrillkalita](https://avatars.githubusercontent.com/u/2401848?v=4)](https://github.com/cyrillkalita "cyrillkalita (1 commits)")[![danswiser](https://avatars.githubusercontent.com/u/6931029?v=4)](https://github.com/danswiser "danswiser (1 commits)")[![dmhernandez2525](https://avatars.githubusercontent.com/u/47400105?v=4)](https://github.com/dmhernandez2525 "dmhernandez2525 (1 commits)")[![facundofarias](https://avatars.githubusercontent.com/u/2700564?v=4)](https://github.com/facundofarias "facundofarias (1 commits)")[![IvanD4RE](https://avatars.githubusercontent.com/u/117346644?v=4)](https://github.com/IvanD4RE "IvanD4RE (1 commits)")[![makhnovskiy](https://avatars.githubusercontent.com/u/3479205?v=4)](https://github.com/makhnovskiy "makhnovskiy (1 commits)")

### Embed Badge

![Health badge](/badges/ivand4re-google-maps-lumen-v9/health.svg)

```
[![Health](https://phpackages.com/badges/ivand4re-google-maps-lumen-v9/health.svg)](https://phpackages.com/packages/ivand4re-google-maps-lumen-v9)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
