|Classes of Sergii Pryz||PHP Location Based Search API||README.md||Download|
Place Search Api
RESTfull API to provide search places around choosing radius. In other words it can answer to "Where are bars in 2km near me?".
PlaceSearchApi is using Google Places API as a search source. But it's possible to integrate different search engine using applications Adapter API.
The endpoint is
Name | Method | Required parameters | Optional parameters | Example --- | --- | --- | --- | --- bar | GET | location, radius | language | GET:bar?location="54.3476107,18.6503288"&radius="2000"
Name | Type | Default | Description | Value range --- | --- | --- | --- | --- location | String,String | 54.3476107,18.6503288 | Comma separated latitude, longitude. Default value is Neptune?s Fountain in Gda?sk| For latitude number in range [-90, 90]. For longitude number in range [-180, 180]. radius | Integer | 2000 | Radius over location point in meters | Radius should be in range [1, 50 000] language | String | en | Two character language code | See the list of supported languages by Google Places.
Here is request-response example for Bar resource Request:
The limit for number of bars in response is 20. That limitation is a result of MVP choose and can be extended in next version. Please view feature candidate document or open an issue to start discussion.
All errors message have one format that is described bellow:
Table bellow shows list of supported HTTP codes.
Code | Message | Description --- | --- | --- 500 | 500 Internal Server Error | Critical application error 501 | 501 Not Implemented | HTTP method was not implemented for that resource 404 | 404 Not Found | Resource was not found
Architecture is based on Hexagonal Architecture. To see what that architecture involve please visit:
PlaceSearchApi has those layers:
PlaceSearchApi follows layer architecture with DI using Interfaces therefore it's possible to provide any modification.
How to change Framework
PlaceSearchApi is using Silex with controllers as a services so to use another framework:
Add new place type
PlaceSearchApi supports for now
Extend response data
To make possible return working hours in api response it's need:
Use different HTTP client
That section describes how PlaceSearchApi deals with dependency.
PlaceSearchApi does not have Framework dependency:
3-rd party dependency
PlaceSearchApi uses own Interfaces and wrappers over 3-rd party applications additionally it's catch and resend own Exceptions.
Having layer architecture additional with composition bring independent and clear communication between modules.
Here is a list of rules that were placed over PlaceSearchApi:
To configure developing environment please:
Docker container is configured to use xDebug.
Future features candidates
If you find this project worth to use please add a star. Follow changes to see all activities. And if you see room for improvement, proposals please feel free to create an issue or send pull request. Here is a great guide to start contributing.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project and its community you agree to abide by those terms.
PlaceSearchApi is licensed under the MIT License. Please see the LICENSE file for details.