bart/google-places

PHP wrapper for Google Places API

dev-master 2014-06-13 14:13 UTC

This package is not auto-updated.

Last update: 2024-11-05 03:01:43 UTC


README

The GooglePlaces library is a PHP wrapper for Google Places API

Build Status Coverage Status

Instalation

GooglePlaces uses Composer for autoloading.

Add bart/google-places to your composer.json

"require": {
    "bart/google-places": "dev-master"
}

Or execute composer.phar require "bart/google-places:dev-master"

Note

GooglePlaces follows the PSR-4 standard for autoloading.

Usage

<?php

require_once 'vendor/autoload.php';

use bart\GooglePlaces\GooglePlaces;

$places = new GooglePlaces('<<YOUR_API_KEY>>');

Nearby Search

Method declaration:

public function nearbySearch(array $location, $radius, $sensor, array $parameters = [])

Example usage:

$result = $places
    ->nearbySearch([54.465224,17.017558], 2000, false, ['keyword' => 'coffee',])
    ->arrayResult();

Returns SearchResult object

Next Page

Method declaration:

public function next()

Example usage:

Important!: You can execute next method only when previous query returned valid result containing next_page_token

$result = $places
    ->next()
    ->arrayResult();

Info

This repository is under heavy development, the goal is to implement and test all Google Places API functions.