Download the PHP package lquintana/google-places-popular-times without Composer
On this page you can find all versions of the php package lquintana/google-places-popular-times. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lquintana/google-places-popular-times
More information about lquintana/google-places-popular-times
Files in lquintana/google-places-popular-times
Package google-places-popular-times
Short Description Get google places with its own pupular time for Laravel >= 5.8
License MIT
Homepage https://github.com/1quintana/google-popular-time
Informations about the package google-places-popular-times
GooglePopularTime for Laravel
Introduction
Using this package you can get a list of places with its popular times or also a place details with its popular times. Time and percentage of popularity for certain time is also included in the results.
Follow the google API documentation to understand their requirements and use this package https://developers.google.com/places/web-service/intro
Requirements
- >= PHP 7.1
- >= Laravel 5.8
Installation
Via Composer
Configuration
You need to create a google key from the google console give it the rigth permisions to use places API. Add the following variables to the .env file in your project Laravel and replace the string YOUR-GOOGLE-KEY for the google key.
Publish the config file with following artisan command
Usage
Here there is an example of url when trying to get a list of popular places.
http://places.test/api/places?location=26.189774,-80.103775&radius=5000&keyword=restaurants
You should add the route places to route/api.php or create the route in any convinient location for your project
@ This is an example of my controller in Laravel. You can find the method index which will list places with its own popular time for each of them
Here Some screenshots with the result from the previous method.
if you open the key popular times it contains all the days of the week
- Keep in mind that Google Places API require location=26.189774,-80.103775&radius=5000 as minimum parameters.
- Check the Google documentation in the following link to know more about the allowed parameters.
https://developers.google.com/places/web-service/search
This is an example of the url to get a place with its own popular times.
http://places.test/api/places/ChIJ5z2kxpsB2YgRjUgd_WuWdWc
Google Places API Minimum params required placeid, ex placeid=ChIJde9xlp4B2YgRVl9hn3TriiI
- Refer to google documentation for more details.
https://developers.google.com/places/web-service/details
@ The next code is an example of my controller in Laravel. You can find the method index which list places with its own popular time for each of them and the method show to show only one place with its own popular times.
This is an example of the url to get a place with its own popular times.
http://places.test/api/places/ChIJ5z2kxpsB2YgRjUgd_WuWdWc
- Do not forget to create the route.
In the results you can find the time and percentage of popularity in that time.
If you just want a list of places without popular time this is the method
If you just want a place details without popular time this is the method
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
- Luciano Quintana (Venmo a coffee if you like this work @kinpal80)
- All Contributors
License
license. Please see the license file for more information.
All versions of google-places-popular-times with dependencies
friendsofphp/php-cs-fixer Version ^2.16
guzzlehttp/guzzle Version ^6.0