PHPackages                             markenwerk/google-places-suite - 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. markenwerk/google-places-suite

AbandonedArchivedLibrary[API Development](/categories/api)

markenwerk/google-places-suite
==============================

A PHP library to query Google's Places service for querying locations and addresses and getting details by Places ID.

3.0.1(9y ago)017[1 issues](https://github.com/markenwerk/php-google-places-suite/issues)MITPHPPHP &gt;=5.3

Since Apr 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/markenwerk/php-google-places-suite)[ Packagist](https://packagist.org/packages/markenwerk/google-places-suite)[ Docs](http://markenwerk.net/)[ RSS](/packages/markenwerk-google-places-suite/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (5)Versions (10)Used By (0)

PHP Google Places Suite
=======================

[](#php-google-places-suite)

[![Build Status](https://camo.githubusercontent.com/f78ac91786b679575e5ddf254117fef1a00ff89aeb638d885b1c5ef91feebc65/68747470733a2f2f7472617669732d63692e6f72672f6d61726b656e7765726b2f7068702d676f6f676c652d706c616365732d73756974652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/markenwerk/php-google-places-suite)[![Test Coverage](https://camo.githubusercontent.com/d4354e51209d8f451e802c52e1c046f3df67b40d6ee3087f2d092c1966a0ba2c/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d61726b656e7765726b2f7068702d676f6f676c652d706c616365732d73756974652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/markenwerk/php-google-places-suite/coverage)[![Dependency Status](https://camo.githubusercontent.com/13e019474ac6aef195aef64755918c7743b408336be8e73abaa90756322fb04f/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537316637383433666364313961303033396631383134392f62616467652e737667)](https://www.versioneye.com/user/projects/571f7843fcd19a0039f18149)[![SensioLabs Insight](https://camo.githubusercontent.com/6d84ca3277bcaa7cebe788b3a540653c29ad91ff4acc6923ab15060ef2d979c3/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f34353961646265312d343961622d343539342d616563622d6335303561343430626235382e737667)](https://insight.sensiolabs.com/projects/459adbe1-49ab-4594-aecb-c505a440bb58)[![Code Climate](https://camo.githubusercontent.com/6c79425dc34301ec8f85782137a79522e22fb88bd95819fee57ff69d3aba3831/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d61726b656e7765726b2f7068702d676f6f676c652d706c616365732d73756974652f6261646765732f6770612e737667)](https://codeclimate.com/github/markenwerk/php-google-places-suite)[![Latest Stable Version](https://camo.githubusercontent.com/39814bfd9852b3d136ad267712a70bafc357543d5a437bcbc2921a631e31157a/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b656e7765726b2f676f6f676c652d706c616365732d73756974652f762f737461626c65)](https://packagist.org/packages/markenwerk/google-places-suite)[![Total Downloads](https://camo.githubusercontent.com/5516bebc2f3d9bd4be307de63f196e3107ec3136540f633849eb89fd03a7e78e/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b656e7765726b2f676f6f676c652d706c616365732d73756974652f646f776e6c6f616473)](https://packagist.org/packages/markenwerk/google-places-suite)[![License](https://camo.githubusercontent.com/fb16dd93a3f66eaf055c3af9a4b3783eb4d0b0bf3fe7cea672cee687e30c3783/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b656e7765726b2f676f6f676c652d706c616365732d73756974652f6c6963656e7365)](https://packagist.org/packages/markenwerk/google-places-suite)

A PHP library to query Google's Places service for querying locations and addresses and getting details by Places ID.

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

[](#installation)

```
{
   	"require": {
        "markenwerk/google-places-suite": "~3.0"
    }
}

```

Usage
-----

[](#usage)

### Autoloading and namesapce

[](#autoloading-and-namesapce)

```
require_once('path/to/vendor/autoload.php');

```

---

### Performing a Google Places Query

[](#performing-a-google-places-query)

#### Getting detail information about a known Google Places ID

[](#getting-detail-information-about-a-known-google-places-id)

```

use Markenwerk\CommonException;

try{
	// Perform query
	$googlePlacesDetailQuery = new GooglePlacesDetailQuery();
	$googlePlacesDetailQuery
		->setApiKey($this->googlePlacesApiKey)
		->query('GOOGLE_PLACES_ID');

	// Retrieving the query result as Markenwerk\GooglePlacesSuite\GooglePlacesDetailResult instance
	$queryResult = $googlePlacesDetailQuery->getResult();

} catch (CommonException\NetworkException\CurlException) {
	// Google Places service is not reachable or curl failed
} catch (CommonException\ApiException\InvalidResponseException $exception) {
	// Google Places service invalid response
} catch (CommonException\ApiException\RequestQuotaException $exception) {
	// Google Places service requests over the allowed limit
} catch (Markenwerk\CommonException\ApiException\AuthenticationException $exception) {
	// Google Places service API key invalid
} catch (CommonException\ApiException\NoResultException $exception) {
	// Google places service query had no result
}

```

---

### Reading from a GooglePlacesDetailResult

[](#reading-from-a-googleplacesdetailresult)

**Attention:** Plaese note that all getter methods on the `GeoLocationAddress` return a `GeoLocationAddressComponent` instance or `null`. For preventing calls on non-objects the `GeoLocationAddress` class provides methods to check whether the address components exists.

```
// Retrieving the query result as Markenwerk\GooglePlacesSuite\GooglePlacesDetailResult instance
$queryResult = $googlePlacesDetailQuery->getResult();

// Retieving address information as Markenwerk\GoogleDataStructure\GeoLocation\GeoLocationAddress
if($queryResult->hasAddress()) {

	if ($queryResult->getAddress()->hasStreetName()) {
		// Returns 'Lornsenstraße'
		$addressStreetShort = $queryResult->getAddress()->getStreetName()->getShortName();
		// Returns 'Lornsenstraße'
		$addressStreetLong = $queryResult->getAddress()->getStreetName()->getLongName();
	}

	if ($queryResult->getAddress()->hasStreetNumber()) {
		// Returns '43'
		$addressStreetNumberShort = $queryResult->getAddress()->getStreetNumber()->getShortName();
		// Returns '43'
		$addressStreetNumberLong = $queryResult->getAddress()->getStreetNumber()->getLongName();
	}

	if ($queryResult->getAddress()->hasPostalCode()) {
		// Returns '24105'
		$addressPostalCodeShort = $queryResult->getAddress()->getPostalCode()->getShortName();
		// Returns '24105'
		$addressPostalCodeLong = $queryResult->getAddress()->getPostalCode()->getLongName();
	}

	if ($queryResult->getAddress()->hasCity()) {
		// Returns 'KI'
		$addressCityShort = $queryResult->getAddress()->getCity()->getShortName();
		// Returns 'Kiel'
		$addressCityLong = $queryResult->getAddress()->getCity()->getLongName();
	}

	if ($queryResult->getAddress()->hasArea()) {
		// Returns 'Ravensberg - Brunswik - Düsternbrook'
		$addressAreaShort = $queryResult->getAddress()->getArea()->getShortName();
		// Returns 'Ravensberg - Brunswik - Düsternbrook'
		$addressAreaLong = $queryResult->getAddress()->getArea()->getLongName();
	}

	if ($queryResult->getAddress()->hasProvince()) {
		// Returns 'SH'
		$addressProvinceShort = $queryResult->getAddress()->getProvince()->getShortName();
		// Returns 'Schleswig-Holstein'
		$addressProvinceLong = $queryResult->getAddress()->getProvince()->getLongName();
	}

	if ($queryResult->getAddress()->hasCountry()) {
		// Returns 'DE'
		$addressCountryShort = $queryResult->getAddress()->getCountry()->getShortName();
		// Returns 'Germany'
		$addressCountryLong = $queryResult->getAddress()->getCountry()->getLongName();
	}

}

// Retieving address information as Markenwerk\GoogleDataStructure\GeoLocation\GeoLocationGeometry
if ($queryResult->hasGeometry()) {

	if ($queryResult->getGeometry()->hasLocation()) {
		// Returns 54.334123
		$geometryLocationLatitude = $queryResult->getGeometry()->getLocation()->getLatitude();
		// Returns 10.1364007
		$geometryLocationLatitude = $queryResult->getGeometry()->getLocation()->getLongitude();
	}

	if ($queryResult->getGeometry()->hasViewport()) {
		// Returns 54.335471980291
		$geometryLocationLatitude = $queryResult->getGeometry()->getViewport()->getNortheast()->getLatitude();
		// Returns 10.137749680292
		$geometryLocationLatitude = $queryResult->getGeometry()->getViewport()->getNortheast()->getLongitude();
		// Returns 54.332774019708
		$geometryLocationLatitude = $queryResult->getGeometry()->getViewport()->getSouthwest()->getLatitude();
		// Returns 10.135051719708
		$geometryLocationLatitude = $queryResult->getGeometry()->getViewport()->getSouthwest()->getLongitude();
	}

	if ($queryResult->getGeometry()->hasAccessPoints()) {
		for ($i = 0; $i < $queryResult->getGeometry()->countAccessPoints(); $i++) {
			// Returns 54.335471980291
			$geometryAccessPointLatitude = $queryResult->getGeometry()->getAccessPointAt($i)->getLatitude();
			// Returns 10.137749680292
			$geometryAccessPointLatitude = $queryResult->getGeometry()->getAccessPointAt($i)->getLongitude();
		}
	}

}

if ($queryResult->hasGooglePlacesId()) {
	// Retrieving the Google Places information from the query result
	// Returns 'ChIJ_zNzWmpWskcRP8DWT5eX5jQ'
	$googlePlacesId = $queryResult->getGooglePlacesId();
}

```

Exception handling
------------------

[](#exception-handling)

PHP Google Places Suite provides different exceptions provided by the PHP Common Exceptions project for proper handling.
You can find more information about [PHP Common Exceptions at Github](https://github.com/markenwerk/php-common-exceptions).

Contribution
------------

[](#contribution)

Contributing to our projects is always very appreciated.
**But: please follow the contribution guidelines written down in the [CONTRIBUTING.md](https://github.com/markenwerk/php-google-places-suite/blob/master/CONTRIBUTING.md) document.**

License
-------

[](#license)

PHP Google Places Suite is under the MIT license.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity64

Established project with proven stability

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.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~20 days

Total

9

Last Release

3637d ago

Major Versions

1.2 → 2.02016-04-26

2.2.0 → 3.0.02016-07-11

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5921241?v=4)[Martin Brecht-Precht](/maintainers/bonscho)[@Bonscho](https://github.com/Bonscho)

---

Tags

composer-packagegoogle-placesgoogle-places-apilookupphp-librarygooglegeolocationgoogle placesgeolookup

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markenwerk-google-places-suite/health.svg)

```
[![Health](https://phpackages.com/badges/markenwerk-google-places-suite/health.svg)](https://phpackages.com/packages/markenwerk-google-places-suite)
```

###  Alternatives

[google/apiclient

Client library for Google APIs

9.8k205.9M1.1k](/packages/google-apiclient)[geoip2/geoip2

MaxMind GeoIP PHP API

2.5k92.0M344](/packages/geoip2-geoip2)[google/apiclient-services

Client library for Google APIs

1.3k195.1M59](/packages/google-apiclient-services)[google/gax

Google API Core for PHP

267116.3M528](/packages/google-gax)[skagarwal/google-places-api

Google Places Api

1973.3M9](/packages/skagarwal-google-places-api)[google/common-protos

Google API Common Protos for PHP

175112.8M67](/packages/google-common-protos)

PHPackages © 2026

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