51degrees/fiftyone.geolocation
Composer 安装命令:
composer require 51degrees/fiftyone.geolocation
包简介
Geolocation engines for 51Degrees Pipeline API. Perform reverse geocoding using longitude and latitude to populate postal addresses.
README 文档
README
Introduction
This repository contains the geo-location engines for the PHP implementation of the Pipeline API.
Pre-requesites
The Pipeline engines are written in PHP and target 5 and 7.
Packages
- geoLocation - A Node.js engine which retrieves geo-location results by consuming data from the 51Degrees cloud service.
- geoLocationPipelineBuilder - Contains the geo-location engine builders.
Installation
You can either reference the projects in this repository or you can reference the Composer packages in your project:
"require": {
"51degrees/fiftyone.geolocation": "@dev",
...
Make sure to select the latest version from Composer.
Configuration Options
- String
type- The name of the type of geolocation service to use. - String
resourceKey- Resource Key is evidence used within the Cloud service for monitoring usage. Obtain a resource key. - Array
restrictedProperties- The properties to populate values for in the result (all are populated by default).
Examples
Examples can be found in the examples folder. See below for a list of examples.
| Example | Description | Implemtation |
|---|---|---|
| gettingstarted.php | This example uses geo-location to determine the country from a longitude and latitude. | Cloud |
| configurefromfile.php | This examples creates a pipeline from a configuration file to set up geo-location. | Cloud |
| combiningservices.php | This example uses geo-location alongside device detection to determine the country and device. | Cloud |
| webIntegration.php | This example demonstrates how to integrate the geo-location solution into a website. | Cloud |
Ensure the resource_key environment variable is set to your resource key prior to running the example scripts.
To run the examples, go to the examples directory and run:
php -S localhost:8080
The examples will now be available to view in a browser. For example, the cloud getting started example will be available
by browsing to localhost:8080/cloud/gettingstarted.php.
Tests
In this repository, there are tests using phpunit. You will need to install the package dependencies to run them:
composer install
To run the tests, then call:
phpunit --fail-on-warning --display-warnings --log-junit test-results.xml
Project documentation
For complete documentation on the Pipeline API and associated engines, see the 51Degrees documentation site.
统计信息
- 总下载量: 93
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: EUPL-1.2
- 更新时间: 2020-06-19