Giter VIP home page Giter VIP logo

google-maps-php-sdk's People

Contributors

biscolab avatar pryznar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

google-maps-php-sdk's Issues

Language GoogleMapsApiConfigFields Geocoding

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

PHP Fatal error

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

How to check if location is within bounds

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));

Not compatible with Guzzle 7.X

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].

I cannot get next page

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):

  • OS: Arch Linux 5.17.6-arch1-1
  • PHP version 7.4

Unable to get opening hours

$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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.