src/Helper.php
public function IP2City($ip)
    {
        $baidu_IP_url = 'http://api.map.baidu.com/location/ip?ak=bsa3LH1GT1jhOep5N7Uz950xtTQWvp9I&ip='.$ip.'&coor=bd09ll';
        $client = new Client();
        $json = $client->get($baidu_IP_url)->getBody();
        
        return json_decode($json, true);
    }
public function IP2City($ip)
    {
        $baidu_IP_url = 'http://api.map.baidu.com/location/ip?ak=bsa3LH1GT1jhOep5N7Uz950xtTQWvp9I&ip='.$ip.'&coor=bd09ll';
        $client = new Client();
        $json = $client->get($baidu_IP_url)->getBody();
        
        return json_decode($json, true);
    }
public function IP2City ( $ ip ) { $ baidu_IP_url = 'http://api.map.baidu.com/location/ip?ak=bsa3LH1GT1jhOep5N7Uz950xtTQWvp9I&ip=' . $ ip . '&coor=bd09ll' ; $ client = new Client ( ) ; $ json = $ client -> get ( $ baidu_IP_url ) -> getBody ( ) ; return json_decode ( $ json , true ) ; }
IP to City

@return array
IP to City