munna / iplocation
Geo Location Tracking By IP address. Its providing more flexible information about any country.. Its completely free and open source.
Installs: 49
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
This package is auto-updated.
Last update: 2024-11-16 15:29:42 UTC
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.