2017 © Pedro Peláez
 

library geography

geographic position api

image

cocoyo/geography

geographic position api

  • Sunday, September 17, 2017
  • by ningge123
  • Repository
  • 0 Watchers
  • 4 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

geography

根据ip地址获取地址位置信息,这是基于百度api开放接口,使用前需要申请密钥(AK)., (*1)

使用

这是一个标准的composer包:, (*2)

composer require cocoyo/geography, (*3)

laravel中使用:, (*4)

 在cofig/services.php中添加配置

 'baidu' => [
         'ak' => '你的ak'
     ],

 Cocoyo\Geography\GeographyServiceProvider::class,注册服务提供者

 app('geography')->position($ip);

 或者使用依赖注入形式使用

一般项目中使用:, (*5)

require './vendor/autoload.php';

$gegoraphy = new \Cocoyo\Geography\Geography(['ak' => '你的ak']);

$info = $gegoraphy->position('220.181.108.99');

返回内容, (*6)

Array
(
    [address_detail] => Array
        (
            [province] => 广东省
            [city] => 深圳市
            [district] => 
            [street] => 
            [street_number] => 
            [city_code] => 340
        )

    [address] => 广东省深圳市
    [point] => Array
        (
            [y] => 2560682.35
            [x] => 12693451.44
        )

)

嗯!暂时还没做单元测试,后期补上。。, (*7)

The Versions

17/09 2017

dev-master

9999999-dev

geographic position api

  Sources   Download

MIT

The Requires

 

by cocoyo

17/09 2017

v0.1

0.1.0.0

geographic position api

  Sources   Download

MIT

The Requires

 

by cocoyo