brunoric/php-poc-geoapi

0.0.1 2018-06-24 23:24 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:55:17 UTC


README

Build Status

这是一个非常小的用于计算地球上两点之间距离的证明概念。此应用程序提供一个小型的REST API,用于处理一些客户数据及其位置。

安装和玩耍

要安装并玩耍这个PoC,您只需要一个PHP 7.1+环境,并且已安装composer,然后在您的CLI中运行以下命令:

composer create-project brunoric/php-poc-geoapi

要从项目路径中开始玩耍,请运行以下命令:

bin/console server:start

这将运行PHP内置的服务器,使应用程序在 http://127.0.0.1:8000 上可用。

客户列表

要从默认客户存储库列出客户,请访问端点 *

http://127.0.0.1:8000/customer/list

然后您可以玩转客户属性(id、姓名、纬度、经度)以及使用“asc”或“desc”作为排序方向。

# will output the customers order by ID ascendent.
http://127.0.0.1:8000/customer/list/id/asc

# will output the customers order by ID descentend.
http://127.0.0.1:8000/customer/list/id/desc

# will output the customers order by NAME ascendent.
http://127.0.0.1:8000/customer/list/name/asc

# will output the customers order by NAME descentend.
http://127.0.0.1:8000/customer/list/id/desc

# will output the customers order by LATITUDE ascendent.
http://127.0.0.1:8000/customer/list/id/asc

# will output the customers order by LATITUDE descentend.
http://127.0.0.1:8000/customer/list/id/desc

# will output the customers order by LONGITUDE ascendent.
http://127.0.0.1:8000/customer/list/id/asc

# will output the customers order by LONGITUDE descentend.
http://127.0.0.1:8000/customer/list/id/desc

要按特定点的距离排序客户,只需调用 **

# will output the customers order by DISTANCE ascendent.
http://127.0.0.1:8000/customer/list/distance/asc

# will output the customers order by DISTANCE descentend.
http://127.0.0.1:8000/customer/list/distance/desc

* 当前客户正在从S3桶中的封闭列表中加载。

* 默认纬度为53.339428,默认经度为-6.257664。