biscolab / google-maps-php-sdk Goto Github PK
View Code? Open in Web Editor NEWGoogle Maps PHP SDK
Home Page: https://gmaps-php-docs.biscolab.com
License: MIT License
Google Maps PHP SDK
Home Page: https://gmaps-php-docs.biscolab.com
License: MIT License
Hi there,
I use your very useful and easy to use SDK. Thank you for this open source work!
Would it be possible to update it by adding the language parameter (Optional parameters in a Geocoding request).
My client is French and wants to display the countries in French.
Currently, I maintain an English > French translation in my code which could be corrected by the language parameter passed in the request.
Thanks a lot
First of all. Great API!
I might be using your program wrong, but program exits and terminates on some specific addresses.
PHP Fatal error: Uncaught Biscolab\GoogleMaps\Exception\RequestException: Something went wrong: ZERO_RESULTS in /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/Http/GoogleMapsResponse.php:143 Stack trace: #0 /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/Http/GoogleMapsResponse.php(97): Biscolab\GoogleMaps\Http\GoogleMapsResponse->parseResponse() #1 /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/Http/GoogleMapsClient.php(63): Biscolab\GoogleMaps\Http\GoogleMapsResponse->__construct(Object(GuzzleHttp\Psr7\Response)) #2 /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/GoogleMapsApi.php(127): Biscolab\GoogleMaps\Http\GoogleMapsClient->get('https://maps.go...', 'key=AIzaSyDMHdT...') #3 /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/Abstracts/Api.php(145): Biscolab\GoogleMaps\GoogleMapsApi->get(Object(Biscolab\GoogleMaps\Http\GoogleMapsRequest)) #4 /var/www/clients/client3/web30/web/vendor/biscol in /var/www/clients/client3/web30/web/vendor/biscolab/google-maps-php-sdk/src/Http/GoogleMapsResponse.php on line 143
Thank you for this library.
Not sure if it's possible, but can this library be used to check if a location is within specific bounds? Something like this:
function latLng($arr) {
return new Biscolab\GoogleMaps\Object\LatLng([
Biscolab\GoogleMaps\Fields\LatLngFields::LAT => $arr['lat'],
Biscolab\GoogleMaps\Fields\LatLngFields::LNG => $arr['lng']
]);
}
$bounds = new Biscolab\GoogleMaps\Object\LatLngBounds();
$bounds->extend(latLng([
"lat" => 132334323,
"lng" => 112143432
]));
$place = latLng([
"lat" => 133434323
"lng" => 5352523
]);
print_r($bounds->getCenter());
print_r($bounds->contains($place));
Unfortunately I can't add custom request like 'language' :(
We're using this package in a Laravel 7 project that we're upgrading to Laravel 8. Laravel 8 requires guzzlehttp/guzzle ^7.0.1 however this package currently only supports guzzle 5 & 6 in it's composer.json
Problem 1 - biscolab/google-maps-php-sdk[0.8.0, ..., 0.8.2] require guzzlehttp/guzzle 5.*|6.* -> found guzzlehttp/guzzle[5.0.0, ..., 5.3.x-dev, 6.0.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1). - Root composer.json requires biscolab/google-maps-php-sdk ^0.8 -> satisfiable by biscolab/google-maps-php-sdk[0.8.0, 0.8.2].
Describe the bug
It is impossible to get next page items of textsearch
To Reproduce
Just add package to the project
and run:
$placesApi = new Places([
GoogleMapsApiConfigFields::KEY => 'XXX',
]);
$results1 = $placesApi->textSearch('xxx');
$results2 = $placesApi->getNextPage();
Expected behavior
$results2 to be next page items instead of $results1 items
I found out why this happens. That's because instead of pagetoken
. next_page_token
param is set.
/**
* @return GoogleMapsResultsCollection
*/
public function getNextPage(): GoogleMapsResultsCollection
{
if ($this->responseHasNewPage()) {
$this->request->setParam(GoogleMapsRequestFields::NEXT_PAGE_TOKEN, $this->response->getNextPageToken());
}
return $this->getResponseResult();
}
https://developers.google.com/maps/documentation/places/web-service/search-text
pagetoken
Returns up to 20 results from a previously run search. Setting a pagetoken parameter will execute a search with the same parameters used previously โ all parameters other than pagetoken will be ignored.
Server side (please complete the following information):
$places = new \Biscolab\GoogleMaps\Api\Places([
GoogleMapsApiConfigFields::KEY => $API_KEY
]);
$results_by_name = $places->findPlaceByText($address, $params, $fields);
$first_result = $results_by_name->current();
$place_id = $first_result->getPlaceId();
$candidate = $places->details($place_id, $params);
$opening_hours = $candidate->getOpeningHours();
it appears the $open_hours is always blank, has this been implemented, or can someone explain how to retrieve this information/. test POI have the opening hours listed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.