PHP code example of joshtronic / php-googleplaces

1. Go to this page and download the library: Download joshtronic/php-googleplaces library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joshtronic / php-googleplaces example snippets


$google_places = new joshtronic\GooglePlaces('_YOUR_API_KEY_');

$google_places->location = array(-33.86820, 151.1945860);
$google_places->radius   = 800;
$results                 = $google_places->nearbySearch();

$google_places->location = array(-33.86820, 151.1945860);
$google_places->rankby   = 'distance';
$google_places->types    = 'restaurant'; // Requires keyword, name or types
$results                 = $google_places->nearbySearch();

$google_places->pagetoken = $results['next_page_token'];
$page2_results            = $google_places->nearbySearch();

$google_places->location = array(-33.86820, 151.1945860);
$google_places->radius   = 800;
$google_places->types    = 'restaurant'; // Requires keyword, name or types
$results                 = $google_places->radarSearch();

$google_places->reference = '#reference#'; // Reference from search results
$details                  = $google_places->details();
json
""joshtronic/php-googleplaces": "dev-master"
}