2017 © Pedro PelĂĄez
 

library google-places

PHP wrapper Google Places API

image

mills/google-places

PHP wrapper Google Places API

  • Sunday, March 4, 2018
  • by anthony-mills
  • Repository
  • 13 Watchers
  • 76 Stars
  • 15,113 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 54 Forks
  • 6 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

PHP wrapper for using the Google Places API. Based on the GPLV2 class created by André Nosalsky., (*1)

BASIC USAGE

<?php
require_once('googlePlaces.php');

$apiKey       = 'Your Google Places API Key';
$googlePlaces = new googlePlaces($apiKey);

// Set the longitude and the latitude of the location you want to search near for places
$latitude   = '-33.8804166';
$longitude = '151.2107662';
$googlePlaces->setLocation($latitude . ',' . $longitude);

$googlePlaces->setRadius(5000);
$results = $googlePlaces->search(); //

A search query can be run again for a fresh set of results using the "paging" functionality that was recently added to the API., (*2)

To use simply perform a place search as per normal, and then call the repeat method afterward with the 'next_page_token' element returned by the first search eg., (*3)

$firstSearch = $googlePlaces->Search();

if (!empty($firstSearch['next_page_token'])) {
    $secondSearch = $googlePlaces->repeat($firstSearch['next_page_token']);
}

The repeat function can be used twice for each search function allowing up to 60 individual results for each search request., (*4)

Proxy

When you use deployment server that changes IP address each time you run a new build, you may want to funnel your request through only one IP address. Therefore, you can allow only that single IP in Google Developers Console server key. For that purpose you should setup proxy to route your Google Maps API requests through that., (*5)

When your proxy is set up, you can use it with googlePlaces., (*6)

$proxy = [];
$proxy["host"] = "your host name";
$proxy["port"] = 8080;
$proxy["username"] = "your username"; //optional with password
$proxy["password"] = "your password";
$apiKey       = 'Your Google Places API Key';
$googlePlaces = new googlePlaces($apiKey, $proxy);

The Versions

04/03 2018

dev-master

9999999-dev https://github.com/anthony-mills/google-places

PHP wrapper Google Places API

  Sources   Download

GPLv2 GPL-2.0-or-later

The Requires

  • php >=5.3.0

 

api geolocation places googleplaces locate

02/02 2018

v1.2

1.2.0.0 https://github.com/anthony-mills/google-places

PHP wrapper Google Places API

  Sources   Download

GPL-2.0-or-later

The Requires

  • php >=5.3.0

 

api geolocation places googleplaces locate

02/02 2018

v1.1

1.1.0.0 https://github.com/anthony-mills/google-places

PHP wrapper Google Places API

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

api geolocation places googleplaces locate

11/01 2017

v1.0

1.0.0.0 https://github.com/anthony-mills/google-places

PHP wrapper Google Places API

  Sources   Download

GPLv2

The Requires

  • php >=5.3.0

 

api geolocation places googleplaces locate