Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 159 | All time: 8,987 This week: 78 |
Version | License | PHP version | Categories | |||
placesearchapi 1.0.0 | MIT/X Consortium ... | 7 | Searching, Web services, Geography, P... |
Description | Author | |||
This package implements an API server for searching places near a location. Innovation Award
|
<?php |
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 http://place-search.dev/api/v1
where
* place-search.dev
- development domain
* api
- indicate that it's api
* v1
- version parameter
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:
GET:bar?location="54.3476107,18.6503288"&radius="2000"
Response:
{
"data": [
{
"id" : "21a0b251c9b8392186142c798263e289fe45b4aa",
"placeId" : "ChIJyWEHuEmuEmsRm9hTkapTCrk",
"location" : {
"lat" : -33.870775,
"lng" : 151.199025
},
"name" : "Rhythmboat Cruises",
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/travel_agent-71.png",
"vicinity" : "Pyrmont Bay Wharf Darling Dr, Sydney",
"scope" : "GOOGLE"
}
],
"count": 1,
"code": 200
}
where:
* data
- bar's collection
* data[0]
- first bar, the bar structure is a limit version of Google Place Search Response
* count
- number of entities inside collection
* code
- http status code
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:
{
"msg": "500 Internal server error",
"code": 500
}
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.
PlaceSearchApi is using Silex with controllers as a services so to use another framework:
PlaceSearchApi supports for now Bar
to add more places it's need only send parameter to Service/Place/GetService
.
To make possible return working hours in api response it's need:
That section describes how PlaceSearchApi deals with dependency.
PlaceSearchApi does not have Framework 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.
Please use proxy client to see requests to Google Places API, e.g. Fiddler for Windows or Fiddler for Mono for Linux machine.
Feature 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 feature
label.
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.
Files (125) |
File | Role | Description | ||
---|---|---|---|---|
config (2 files) | ||||
dev (2 directories) | ||||
doc (1 directory) | ||||
src (1 file, 4 directories) | ||||
web (3 files) | ||||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
FEATURE.CANDIDATE.md | Data | Auxiliary data | ||
LICENSE.txt | Lic. | License | ||
README.md | Doc. | Documentation |
Files (125) | / | config |
File | Role | Description |
---|---|---|
parameters.yml.dist | Data | Auxiliary data |
services.yml | Data | Auxiliary data |
Files (125) | / | dev | / | docker |
File | Role | Description | ||
---|---|---|---|---|
app (1 file, 1 directory) | ||||
docker-compose.yml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (125) | / | dev | / | docker | / | app |
File | Role | Description | ||
---|---|---|---|---|
config (1 directory) | ||||
Dockerfile | Data | Auxiliary data |
Files (125) | / | dev | / | docker | / | app | / | config | / | apache |
File | Role | Description |
---|---|---|
place-search.dev.conf | Data | Auxiliary data |
Files (125) | / | dev | / | tests |
File | Role | Description | ||
---|---|---|---|---|
integration (1 directory) | ||||
unit (1 directory) | ||||
phpunit.xml.dist | Data | Auxiliary data |
Files (125) | / | dev | / | tests | / | integration | / | src |
File | Role | Description | ||
---|---|---|---|---|
Fixture (2 directories) | ||||
Resource (3 files) | ||||
BaseTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | integration | / | src | / | Fixture |
Files (125) | / | dev | / | tests | / | integration | / | src | / | Fixture | / | data |
File | Role | Description |
---|---|---|
google.bar.json | Data | Auxiliary data |
Files (125) | / | dev | / | tests | / | integration | / | src | / | Fixture | / | Guzzle |
File | Role | Description |
---|---|---|
ClientFactory.php | Class | Class source |
Files (125) | / | dev | / | tests | / | integration | / | src | / | Resource |
File | Role | Description |
---|---|---|
BarTest.php | Class | Class source |
ErrorTest.php | Class | Class source |
IndexTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src |
File | Role | Description | ||
---|---|---|---|---|
App (2 directories) | ||||
Engine (1 directory) | ||||
Model (2 files, 1 directory) | ||||
Search (1 file, 2 directories) | ||||
BaseTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | App |
File | Role | Description | ||
---|---|---|---|---|
Controller (2 files) | ||||
Service (2 directories) |
Files (125) | / | dev | / | tests | / | unit | / | src | / | App | / | Controller |
File | Role | Description |
---|---|---|
BarControllerTest.php | Class | Class source |
ErrorControllerTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | App | / | Service | / | Error |
File | Role | Description |
---|---|---|
IternalServerServiceTest.php | Class | Class source |
NotFoundServiceTest.php | Class | Class source |
NotImplementedServiceTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | App | / | Service | / | Place |
File | Role | Description |
---|---|---|
GetServiceTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Engine |
File | Role | Description | ||
---|---|---|---|---|
GoogleSearchPlace (2 files, 1 directory) |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Engine | / | GoogleSearchPlace |
File | Role | Description | ||
---|---|---|---|---|
Http (1 file) | ||||
PlaceRepositoryTest.php | Class | Class source | ||
SchemaCollectionFactoryTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Engine | / | GoogleSearchPlace | / | Http |
File | Role | Description |
---|---|---|
CrawlerTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Model |
File | Role | Description | ||
---|---|---|---|---|
Service (3 files) | ||||
MapperTest.php | Class | Class source | ||
ObjectManagerTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Model | / | Service |
File | Role | Description |
---|---|---|
LocationBuilderTest.php | Class | Class source |
PlaceBuilderTest.php | Class | Class source |
SchemaBuilderTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Search |
File | Role | Description | ||
---|---|---|---|---|
Handler (4 files) | ||||
Service (1 file) | ||||
ConfigTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Search | / | Handler |
File | Role | Description |
---|---|---|
AbstractHandlerTest.php | Class | Class source |
CacheTest.php | Class | Class source |
EmptyDataTest.php | Class | Class source |
EngineTest.php | Class | Class source |
Files (125) | / | dev | / | tests | / | unit | / | src | / | Search | / | Service |
File | Role | Description |
---|---|---|
ResponseBuilderTest.php | Class | Class source |
Files (125) | / | doc | / | uml |
File | Role | Description |
---|---|---|
activity.diagram.png | Data | Auxiliary data |
class.diagram.png | Data | Auxiliary data |
component.diagram.png | Icon | Icon image |
README.md | Doc. | Documentation |
Files (125) | / | src |
Files (125) | / | src | / | App |
File | Role | Description | ||
---|---|---|---|---|
Api (1 file) | ||||
Controller (3 files, 1 directory) | ||||
Di (1 file, 2 directories) | ||||
Exception (3 files) | ||||
Service (1 file, 2 directories) |
Files (125) | / | src | / | App | / | Controller |
File | Role | Description | ||
---|---|---|---|---|
Provider (2 files) | ||||
BarController.php | Class | Class source | ||
ErrorController.php | Class | Class source | ||
IndexController.php | Class | Class source |
Files (125) | / | src | / | App | / | Controller | / | Provider |
File | Role | Description |
---|---|---|
BarProvider.php | Class | Class source |
IndexProvider.php | Class | Class source |
Files (125) | / | src | / | App | / | Di |
File | Role | Description | ||
---|---|---|---|---|
GoogleSearchPlace (1 file) | ||||
Guzzle (1 file) | ||||
ConfigFactory.php | Class | Class source |
Files (125) | / | src | / | App | / | Di | / | GoogleSearchPlace |
File | Role | Description |
---|---|---|
SchemaCollectionFactory.php | Class | Class source |
Files (125) | / | src | / | App | / | Exception |
File | Role | Description |
---|---|---|
ExceptionInterface.php | Class | Class source |
InvalidArgumentException.php | Class | Class source |
RuntimeException.php | Class | Class source |
Files (125) | / | src | / | App | / | Service |
File | Role | Description | ||
---|---|---|---|---|
Error (3 files) | ||||
Place (1 file) | ||||
ServiceProvider.php | Class | Class source |
Files (125) | / | src | / | App | / | Service | / | Error |
File | Role | Description |
---|---|---|
InternalServerService.php | Class | Class source |
NotFoundService.php | Class | Class source |
NotImplementedService.php | Class | Class source |
Files (125) | / | src | / | Engine | / | GoogleSearchPlace |
File | Role | Description | ||
---|---|---|---|---|
Http (1 file) | ||||
PlaceRepository.php | Class | Class source | ||
SchemaCollectionFactory.php | Class | Class source |
Files (125) | / | src | / | Engine | / | GoogleSearchPlace | / | Http |
File | Role | Description |
---|---|---|
Crawler.php | Class | Class source |
Files (125) | / | src | / | Model |
File | Role | Description | ||
---|---|---|---|---|
Api (3 files, 2 directories) | ||||
Data (5 files) | ||||
Exception (4 files) | ||||
Service (6 files) | ||||
Mapper.php | Class | Class source | ||
ObjectManager.php | Class | Class source |
Files (125) | / | src | / | Model | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Data (5 files) | ||||
Service (7 files) | ||||
MapperInterface.php | Class | Class source | ||
ObjectManagerInterface.php | Class | Class source | ||
PlaceRepositoryInterface.php | Class | Class source |
Files (125) | / | src | / | Model | / | Api | / | Data |
File | Role | Description |
---|---|---|
CollectionInterface.php | Class | Class source |
EmptyDataInterface.php | Class | Class source |
LocationInterface.php | Class | Class source |
PlaceInterface.php | Class | Class source |
SchemaInterface.php | Class | Class source |
Files (125) | / | src | / | Model | / | Api | / | Service |
File | Role | Description |
---|---|---|
CollectionFactoryInterface.php | Class | Class source |
LocationBuilderInterface.php | Class | Class source |
PlaceBuilderInterface.php | Class | Class source |
PlaceCollectionBuilderInterface.php | Class | Class source |
SchemaBuilderInterface.php | Class | Class source |
SchemaCollectionBuilderInterface.php | Class | Class source |
SchemaCollectionFactoryInterface.php | Class | Class source |
Files (125) | / | src | / | Model | / | Data |
File | Role | Description |
---|---|---|
Collection.php | Class | Class source |
EmptyData.php | Class | Class source |
Location.php | Class | Class source |
Place.php | Class | Class source |
Schema.php | Class | Class source |
Files (125) | / | src | / | Model | / | Exception |
File | Role | Description |
---|---|---|
ExceptionInterface.php | Class | Class source |
InvalidArgumentException.php | Class | Class source |
RepositoryException.php | Class | Class source |
RuntimeException.php | Class | Class source |
Files (125) | / | src | / | Model | / | Service |
File | Role | Description |
---|---|---|
CollectionFactory.php | Class | Class source |
LocationBuilder.php | Class | Class source |
PlaceBuilder.php | Class | Class source |
PlaceCollectionBuilder.php | Class | Class source |
SchemaBuilder.php | Class | Class source |
SchemaCollectionBuilder.php | Class | Class source |
Files (125) | / | src | / | Search |
Files (125) | / | src | / | Search | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Data (2 files) | ||||
Http (2 files) | ||||
Service (3 files) | ||||
ConfigInterface.php | Class | Class source | ||
HandlerInterface.php | Class | Class source |
Files (125) | / | src | / | Search | / | Api | / | Data |
File | Role | Description |
---|---|---|
ErrorInterface.php | Class | Class source |
ResponseInterface.php | Class | Class source |
Files (125) | / | src | / | Search | / | Api | / | Http |
File | Role | Description |
---|---|---|
ClientInterface.php | Class | Class source |
CrawlerInterface.php | Class | Class source |
Files (125) | / | src | / | Search | / | Api | / | Service |
File | Role | Description |
---|---|---|
ErrorBuilderInterface.php | Class | Class source |
ErrorCollectionBuilderInterface.php | Class | Class source |
ResponseBuilderInterface.php | Class | Class source |
Files (125) | / | src | / | Search | / | Data |
File | Role | Description |
---|---|---|
Error.php | Class | Class source |
Response.php | Class | Class source |
Files (125) | / | src | / | Search | / | Exception |
File | Role | Description |
---|---|---|
CrawlerException.php | Class | Class source |
ExceptionInterface.php | Class | Class source |
InvalidArgumentException.php | Class | Class source |
RuntimeException.php | Class | Class source |
Files (125) | / | src | / | Search | / | Handler |
File | Role | Description |
---|---|---|
AbstractHandler.php | Class | Class source |
Cache.php | Class | Class source |
EmptyData.php | Class | Class source |
Engine.php | Class | Class source |
Files (125) | / | src | / | Search | / | Service |
File | Role | Description |
---|---|---|
ErrorBuilder.php | Class | Class source |
ErrorCollectionBuilder.php | Class | Class source |
ResponseBuilder.php | Class | Class source |
Files (125) | / | web |
File | Role | Description |
---|---|---|
favicon.ico | Data | Auxiliary data |
index.php | Example | Example script |
robots.txt | Data | Robots |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.