munna/iplocation
Composer 安装命令:
composer require munna/iplocation
包简介
Geo Location Tracking By IP address. Its providing more flexible information about any country.. Its completely free and open source.
README 文档
README
Ip Location Tracking
Tracking location info by ip address.
Installing IpLocaiton
Next, run the Composer command to install the latest stable version:
composer require munna/iplocation
Create A Class Instance
to create a class instance
// Use this as namespace use Munna\IpLocation\IpLocation; // Set Your Ip Address $ip = "YOUR_IP_ADDRESS"; //this is optional. Find this api key by visiting https://ipinfo.io/account/home?service=google&loginState=create $api_key = "API_TOKEN"; //If you have this api_key $location = new IpLocation($ip, $api_key); // If you do not have this api_key pass only ip $location = new IpLocation($ip); // Finally init the class $location->init();
After init class instance. You will be get the all of these data.
Provided Data
// Get Ip Address $ip = $location->ip; //full info as an array $info = $location->info(); // get region name $region = $location->region; // get country $country = $location->country; // get city name If you set api_key when create instance $cityName = $location->city; // get ioc name $loc = $location->loc; // get postal $postal = $location->postal; // get flag url $flag = $location->flag; // get timeZone $timeZone = $location->timeZone;
JSON data sample For All Info
{
"ip": "27.147.201.241",
"hostname": "dhknat-27.147.201.241.link3.net",
"city": "Dhaka",
"country": "BD",
"region": "Dhaka",
"loc": "23.7104,90.4074",
"postal": "1000",
"org": "AS23688 Link3 Technologies Ltd.",
"flag": "https://raw.githubusercontent.com/MunnaAhmed/Flags/main/bd.png"
}
License
This package is open-sources and licensed under the MIT license.
Thank you very much. Please give a star.
统计信息
- 总下载量: 121
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-12