tuupola / corelocation
苹果位置服务协议的PHP实现
0.1.0
2017-05-13 09:36 UTC
Requires
- php: ^5.6 || ^7.0
- google/protobuf: ^3.3
Requires (Dev)
- overtrue/phplint: ^0.2.0
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.5
This package is auto-updated.
Last update: 2024-09-10 04:41:49 UTC
README
苹果位置服务协议的PHP实现原型(请点击链接查看详细内容)。此库**不**执行任何实际请求。它仅用于创建和解析请求和响应。
安装
使用 Composer 安装此库。
$ composer require tuupola/corelocation
使用方法
请求
请求类返回一个二进制字符串。读者需要自行决定如何处理它。
require __DIR__ . "/vendor/autoload.php"; use Tuupola\CoreLocation\Request; $request = new Request(["aa:aa:aa:aa:aa:aa", "bb:bb:bb:bb:bb:bb"]); $hex = bin2hex($request->body()); print_r(str_split($hex, 64)); /* Array ( [0] => 00010005656e5f55530013636f6d2e6170706c652e6c6f636174696f6e64000c [1] => 382e342e312e313248333231000000010000002c12130a1161613a61613a6161 [2] => 3a61613a61613a616112130a1162623a62623a62623a62623a62623a62622064 ) */
响应
响应类可用于反序列化响应。读者需要自行确定如何获取响应。
require __DIR__ . "/vendor/autoload.php"; use Tuupola\CoreLocation\Response; $data = file_get_contents("response.bin"); $response = (new Response)->fromString($data); foreach ($response as $router) { print_r($router); } /* Array ( [mac] => cc:cc:cc:cc:cc:cc [latitude] => 27.98785, [longitude] => 86.9228374 [accuracy] => 42 [channel] => 10 ) ... */
测试
您可以通过手动或自动方式在每次代码更改时运行测试。自动测试需要 entr 工作。
$ make test
$ brew install entr $ make watch
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 tuupola@appelsiini.net 反馈,而不是使用问题跟踪器。
许可证
MIT许可证(MIT)。请参阅 许可证文件 了解更多信息。