omnilesolutions / ghanapostgps
用于连接 GhanaPostGPS 的 PHP 包
v0.0.5
2022-02-11 05:26 UTC
Requires
- ext-json: *
- guzzlehttp/guzzle: ^7.4
- phpseclib/phpseclib: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-07 10:36:08 UTC
README
用于 GhanaPostGPS 的 PHP 包
此包与 GhanaPostGPS 连接,以查找加纳的数字地址。
安装
您可以通过 composer 使用以下命令安装此包
composer require omnilesolutions/ghanapostgps
所需条件
在连接到 GhanaPostGPS 之前,您需要以下内容
- Asaase 用户 ID 这是在与 GhanaPostGPS 团队进行入职时提供的,您可以在 GPSAdmin 门户 的个人资料下找到
- 设备 ID 您需要在 GPSAdmin 门户 上创建设备并使用该 ID。请注意,您可以在门户上创建多个设备。
- AES 密钥 GhanaPostGPS 服务器使用 AES 加密与客户端通信。您可以在门户中为每个创建的设备访问 AES 密钥。
数据 API
使用 GhanaPostGPS\GhanaPostGPS
对象获取数据。
$asaaseUser = 'YOUR-ASAASE-USER-ID' $deviceId = 'YOUR-DEVICE-ID' $aesKey = 'YOUR-AES-KEY-FOR-DEVICE' $gps = new GhanaPostGPS\GhanaPostGPS($asaaseUser, $deviceId, $aesKey);
获取 GPS 名称(加纳代码)的位置
// Ghana Code $gpsName = 'GA-585-7449'; // Location contains center latitude and longitude as well as // a box around the center. You also get postcode, region, // area, street, etc. $location = $gps->getLocation($gpsName);
为位置获取 GPS 名称(加纳代码)
$location = [ 'lat' => 5.7525573723, 'lng' => -2.873287368 ]; // The GPS info contains postcode, region, area and street info // for the provided location. $gpsInfo = $gps->getGps($location);
测试
测试以实际连接到 GhanaPostGPS 的方式设置,以确保一切正常。
要运行测试,请在 tests/Unit/GhanaPostGPSTest
中提供您的凭据并运行 vendor/bin/phpunit
先决条件
贡献
欢迎贡献!请对任何错误修复提交 PR,或通过 brightantwiboasiako@aol.com 发送电子邮件进行长期承诺。
许可
此开源项目受 MIT 许可证 许可。