Skip to content
A PHP wrapper for the Google Places API.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Google Places API - A PHP wrapper

Latest Stable Version License Build Status

Logo of Google Places API Web Service

This is a PHP wrapper for Google Places API Web Service.



The recommended installation method is through Composer. Add to your composer.json file:

    "require": {
        "peoplegogo/google-places": "~1.0"

or with the following command from your browser:

composer require peoplegogo/google-places

Check in Packagist.



  • Copy src/GooglePlaces.php to your codebase, perhaps to the vendor directory.
  • Add the GooglePlaces class to your autoloader or require the file directly.

Getting Started

First you have to create an instance of GooglePlaces:

$google_places = new GooglePlaces();

You can pass the API key (used to authenticate in front of Google service) during the creation of the instance or you can set it up later.

$google_places = new GooglePlaces($apiKey);


$google_places = new GooglePlaces();

By default, the format is set to json but you can change it that way:

$google_places = new GooglePlaces($apiKey, $format);



You can also set up the language if you want.


In this way it won't be necessary to set up the language within every request.

You can also prepare the input parameters:

$params = [
	'input' => 'Vict',
	'types' => '(cities)',
	'language' => 'pt_BR' 

Once all parameters are set, the final step is to send the request to the Google Places Api:

$results = $google_places->getAutocomplete($params);

The result is an array. The GooglePlaces class decodes the response received from Google, so it is not necessary for you to do that.

For more information for the methods and the features of the library you can check "src" or "tests" folders.


How can you contribute:

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.
You can’t perform that action at this time.