-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestions for New Features #13
Comments
Hello, I am using this package for some of my projects, I wonder if you already worked to get the images from google, because I can not find any method for that. |
@1quintana I haven't implemented place photos api. I will be implementing it soon. |
Have you implemented https://developers.google.com/places/web-service/add-place? Or anyone has implement this feature? |
@jhnferraris It is implemented. But just a heads up, its deprecated in google places api. Thus it will be removed in future when google stops the api. |
|
Here is a half assed implementation of the photo retrieval. I provide it as a gist, since it lacks the error handling and maybe it's bad programming style. I hope this helps @SachinAgarwal1337 to implement it faster, though. https://gist.github.com/marcus-at-localhorst/7ee1a749bdde56a778360d0e74619a62/revisions I couldn't use the So I added a new guzzle call in the Test script: $places = $this->googlePlaces->nearbySearch('34.5134,-85.31736', 50);
$closest = $places->get('results')->first();
$place = array_intersect_key($closest, array_flip(['place_id','photos','vicinity']));
$place_details = $this->googlePlaces->placeDetails($place['place_id']);
foreach($place_details->get('result')['photos'] as $photo){
$photos[] = $this->googlePlaces->photo($photo['photo_reference'], ['maxheight' => 220]);
} result: 0 => string 'https://lh3.googleusercontent.com/p/AF1QipMeSRPyaS9yDfR9AUW_VyRVfg8p_WDTDJDKszxA=s1600-h220' (length=91)
1 => string 'https://lh3.googleusercontent.com/p/AF1QipMIWLSBHrhvN4G3OgaMs1eHxRbp4Cw2KJpzKpqV=s1600-h220' (length=91)
2 => string 'https://lh3.googleusercontent.com/p/AF1QipNwMIvw6EVNsJaPj_u16FJbXCm6i8pNs__m_KCn=s1600-h220' (length=91)
3 => string 'https://lh3.googleusercontent.com/p/AF1QipM8xq4_4EZEVGehgT7nJ4DPUihso9Jdy5IcD5Rl=s1600-h220' (length=91)
4 => string 'https://lh3.googleusercontent.com/p/AF1QipO49u-XAazQ77y1Lxa4DjXV4lA2EYc_ZHe036_U=s1600-h220' (length=91)
5 => string 'https://lh3.googleusercontent.com/p/AF1QipPlE6NEYYuvf1lOLa24eknI9UZ_zbnUXyluxerQ=s1600-h220' (length=91)
6 => string 'https://lh3.googleusercontent.com/p/AF1QipMsFc-_2rqK3aisgQZ7YcyeQl_c6mCXcCqw-Y_r=s1600-h220' (length=91)
7 => string 'https://lh3.googleusercontent.com/p/AF1QipMVn3ucQKtYzVsTimXEiLn74xEWXu_QtzayaCVz=s1600-h220' (length=91)
8 => string 'https://lh3.googleusercontent.com/p/AF1QipN2EdqVBnNy1zWOAZolhNTlkHewc1H7TWYs7Xln=s1600-h220' (length=91)
9 => string 'https://lh3.googleusercontent.com/p/AF1QipMFavT5igltZhK5UNw6_MXQgrnughdyFxiJ9yzQ=s1600-h220' (length=91) But, I didn't implement the error handling. tl;dr Photo method without error handling as gist |
@1quintana @sifang @marcus-at-localhorst Place Photo Support Added. |
@marcus-at-localhorst Thanks for the Gist. It really helped. |
I'm glad it helped. Thanks! |
Hi, any plans for include functionality of caching results from google? |
@mits87 I feel caching should be part of the application and not package/library. But If there seems to be a need, will surely do add caching. |
@SachinAgarwal1337 & @mits87 Maybe it would be cool if the caching feature was optional? I would agree that it feels more like an app level thing than a library concern. SRP extended to the library level would push me to feel like the library's concern should just be interacting with Google APIs. If it had light & optional support for PSR-6 or PSR-16 Cache that could be kinda neat though. Then, in theory, within an App/Framework the library could just use the underlying Cache instead of implementing its own version. |
@mallardduck Makes Sense. Will try to add caching. |
Specific exceptions for failed request would be nice! Could look something like below:
I felt good and took on the task of implementing this. see pull request. My first contribution on an open source project. Don't show mercy, I can take it :) |
I am open for suggestions for adding new features or enhancements.
Thank you.
Hope you all like this small package.
The text was updated successfully, but these errors were encountered: