Recommend this page to a friend! |
Classes of Sergii Pryz | PHP Location Based Search API | README.md | Download |
|
DownloadPlace Search ApiMasterDevRESTfull 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. RequirementsInstallation
SpecificationEndpointThe endpoint is ResourcesName | Method | Required parameters | Optional parameters | Example --- | --- | --- | --- | --- bar | GET | location, radius | language | GET:bar?location="54.3476107,18.6503288"&radius="2000" ParametersName | 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. ResponseBarHere is request-response example for Bar resource Request:
Response:
where:
* 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. ErrorsAll errors message have one format that is described bellow:
HTTP codesTable 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 ArchitectureArchitecture is based on Hexagonal Architecture. To see what that architecture involve please visit:
PlaceSearchApi has those layers:
ExtensibilityPlaceSearchApi follows layer architecture with DI using Interfaces therefore it's possible to provide any modification. How to change FrameworkPlaceSearchApi is using Silex with controllers as a services so to use another framework:
Add new place typePlaceSearchApi supports for now Extend response dataTo make possible return working hours in api response it's need:
Use different HTTP client
DependencyThat section describes how PlaceSearchApi deals with dependency. Framework dependencyPlaceSearchApi does not have Framework dependency:
3-rd party dependencyPlaceSearchApi uses own Interfaces and wrappers over 3-rd party applications additionally it's catch and resend own Exceptions. Code couplingHaving layer architecture additional with composition bring independent and clear communication between modules. Here is a list of rules that were placed over PlaceSearchApi:
Documentation
DevelopingTo configure developing environment please:
DebugDocker container is configured to use xDebug. ProxyPlease use proxy client to see requests to Google Places API, e.g. Fiddler for Windows or Fiddler for Mono for Linux machine. Future features candidatesFeature candidates are in separate file.
It's a list of ideas that were appeared during development process.
After review some of them will be moved to issues with ContributionIf 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. LicensePlaceSearchApi is licensed under the MIT License. Please see the LICENSE file for details. |