2017 © Pedro Peláez
 

library google-places

A PHP wrapper for the Google Places API.

image

peoplegogo/google-places

A PHP wrapper for the Google Places API.

  • Sunday, April 3, 2016
  • by peoplegogo
  • Repository
  • 2 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Google Places API - A PHP wrapper

Latest Stable Version License Build Status, (*1)

Logo of Google Places API Web Service, (*2)

This is a PHP wrapper for Google Places API Web Service., (*3)

Installation

Composer

The recommended installation method is through Composer. Add to your composer.json file: ``` json { "require": { "peoplegogo/google-places": "~1.0" } }, (*4)

or with the following command from your browser:

composer require peoplegogo/google-places, (*5)


Check [in Packagist](https://packagist.org/packages/peoplegogo/google-places). ### Manually Steps: - 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: ``` php $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. ``` php $google_places = new GooglePlaces($apiKey);, (*6)

or
``` php
$google_places = new GooglePlaces();
$google_places->setApiKey($apiKey);

By default, the format is set to json but you can change it that way: ``` php $google_places = new GooglePlaces($apiKey, $format);, (*7)

or
``` php
$google_places->setFormat($format);

You can also set up the language if you want. ``` php $google_places->setLanguage($language_code);, (*8)

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

You can also prepare the input parameters:
``` php
$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: php $results = $google_places->getAutocomplete($params);, (*9)

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

For more information for the methods and the features of the library you can check "src" or "tests" folders., (*11)

Contributing

How can you contribute:, (*12)

  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.

The Versions

03/04 2016

dev-master

9999999-dev

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places

03/04 2016

1.0.3

1.0.3.0

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places

03/04 2016

dev-develop

dev-develop

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places

31/03 2016

1.0.2

1.0.2.0

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places

31/03 2016

1.0.1

1.0.1.0

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places

30/03 2016

1.0.0

1.0.0.0

A PHP wrapper for the Google Places API.

  Sources   Download

MIT

The Development Requires

by Pavel Tashev

google places