PHP code example of icecho / easyip

1. Go to this page and download the library: Download icecho/easyip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

icecho / easyip example snippets


$config = [
    'provider' => 'tencent',
    'tencent' => [
        'key' => '',
    ],
    
    ...
    ...
    ...
];

$ip = new \Icecho\EasyIp\EasyIp($config);

$result = $ip->parse('');

return [
    'provider' => 'tencent',


    'tencent' => [
        'key' => '',
    ],
    
    ...
    ...
    ...
]
bash
php artisan vendor:publish --provider="Icecho\EasyIp\ServiceProvider"

# 如果想要 api 原生格式,在 config/easyip.php 中,把 format 改为 false

[
     "provider" => "Tencent",
     "ip" => "",
     "postcode" => 440300,
     "country" => "中国",
     "province" => "广东省",
     "city" => "深圳市",
     "district" => "南山区",
     "implode" => "中国广东省深圳市南山区",
     "location" => [
       "latitude" => 22.55329,
       "longitude" => 113.88308,
     ],
]