google-places-api
google-places-api copied to clipboard
Nearby Search doesn't return all fields documented in official Google documentation
The nearbySearch
method returns results, and I am able to retrieve them fine, but I wanted to use the address fields of the place documented in the Google Places API documentation for nearby search results.
But, among others address_components
, adr_address
, formatted_address
. are missing in the results.
The only fields returned are:
- business_status
- geometry
- icon
- icon_background_color
- icon_mask_base_uri
- name
- opening_hours
- place_id
- plus_code
- rating
- reference
- scope
- types
- user_ratings_total
- vicinity
I am doing the following:
$googlePlaces = new PlacesApi($this->api_key);
$params = [
'keyword' => 'restaurant',
'name' => null,
'types' => null,
'pagetoken' => $next_page_token
];
$response = $googlePlaces->nearbySearch($this->location, $this->radius, $params);
$results = $response->all()['results']->all();
var_dump($response);
Am I missing something? How can I get the address details of a place in the results of the nearby search? Of course I can do another api call and get those data but we're doing a large amount of queries so that would double our api usage.
@joldnl if you check the same google documentation you mentioned, you will find the following.


Hope this helps