PHP code example of gplacesphp / api-client

1. Go to this page and download the library: Download gplacesphp/api-client 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/ */

    

gplacesphp / api-client example snippets




ey = '<YOUR_API_KEY>';
$guzzle = new \GuzzleHttp\Client();
$httpClient = new \Http\Adapter\Guzzle6\Client($guzzle);
$requestFactory = new \Zend\Diactoros\RequestFactory();

$client = \GPlacesPhp\ApiClient\Client::create(
    $apiKey,
    $httpClient,
    $requestFactory
);

$placeDetails = $client->placeDetails('ChIJAZ-GmmbMHkcR_NPqiCq-8HI'); // Warsaw

var_dump($placeDetails);




ey = '<YOUR_API_KEY>';
$guzzle = new \GuzzleHttp\Client();
$httpClient = new \Http\Adapter\Guzzle6\Client($guzzle);
$requestFactory = new \Zend\Diactoros\RequestFactory();

$client = \GPlacesPhp\ApiClient\Client::create(
    $apiKey,
    $httpClient,
    $requestFactory
);

$findPlace = $client->findPlace('Warszawa, Polska'); // Warsaw

var_dump($findPlace);

bash
composer tp/guzzle \
    php-http/guzzle6-adapter \
    zendframework/zend-diactoros