chinafuturelink/geo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chinafuturelink/geo

Composer 安装命令:

composer require chinafuturelink/geo

包简介

Location Services of FutureLink

README 文档

README

CircleCI codecov

ChinaFutureLink/GEO

提供地理服务相关接口。

Installing / Getting started

通过Composer安装

composer require fu/geo 2.*

将下面的代码加入composer.json

{
    "require": {
    	"fu/geo": "2.*"
    }
}

Developing

Building

> vendor/bin/phpcs --standard=PSR12 src
> vendor/bin/phpcbf --standard=PSR12 src
> vendor/bin/phpunit 

Generating code coverage report in HTML format ... done [00:00.020]

Features

根据经纬度查询地理位置信息

include "./vendor/autoload.php";

use Fu\Geo\GeoCoder;
use Fu\Geo\Service\Coordinary\TencentCoordinaryLocationService;

const KEY = "YOUR-TENCENT-GEO-SERVICE-KEY";

$latitude  = 29.60001;
$longitude = 91.00001;

$service = new TencentCoordinaryLocationService(KEY);
$response = $service->getLocation($latitude, $longitude);

if ($response->isOk()) {
    $area = $response->getArea();
    $area->nation; // 中国
    $area->lv1;    // 西藏自治区
    $area->lv2;    // 拉萨市
    $area->lv3;    // 堆龙德庆区
} else {
    // get the response raw data...
    var_dump($response->getRaw());   
}

根据IP地址查询地理位置信息

include "./vendor/autoload.php";

use Fu\Geo\IpCoder;
use Fu\Geo\Service\Ip\TencentIpLocationService;

const KEY = "YOUR-TENCENT-GEO-SERVICE-KEY";

$ip = '171.221.208.34';
$service = new TencentIpLocationService(KEY);
$response = $service->getLocation($ip);

if ($response->isOk()) {
    $area = $response->getArea()
    $area->nation; // 中国
    $area->lv1;    // 四川省
    $area->lv2;    // 成都市
    $area->lv3;    // 温江区
} else {
    // get the response raw data...
    var_dump($response->getRaw());
}

根据手机号码查询地理位置信息

include "./vendor/autoload.php";

use Fu\Geo\IpCoder;
use Fu\Geo\Service\Phone\AliPhoneLocationService;

const KEY = "YOUR-ALI-SERVICE-KEY";

$areaCode = '86';
$phone = '13880799123';
$service = new AliPhoneLocationService(KEY);
$response = $service->getLocation($areaCode, $phone);

if ($response->isOk()) {
    $area = $response->getArea()
    $area->nation; // 中国
    $area->lv1;    // 四川省
    $area->lv2;    // 成都市
    $area->lv3;    // 温江区
} else {
    // get the response raw data...
    var_dump($response->getRaw());
}

Links

Licensing

The code in this project is licensed under MIT license.

chinafuturelink/geo 适用场景与选型建议

chinafuturelink/geo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 415 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 chinafuturelink/geo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 chinafuturelink/geo 我们能提供哪些服务?
定制开发 / 二次开发

基于 chinafuturelink/geo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 415
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-22