belal/ip-info

Simple php package to get country from IP address

Maintainers

Package info

github.com/Belal-2000/ip-info

pkg:composer/belal/ip-info

Statistics

Installs: 2 417

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2022-08-23 13:05 UTC

This package is auto-updated.

Last update: 2026-03-25 02:31:29 UTC


README

usage

  • Require the package using composer
composer require belal/ip-info
  • To use it simply call the 'getInfo' method after intanshate an instance of the IpDataProvider class
$IpData = new IpDataProvider();

$result = $IpData->getInfo("Any Ip Address")
  • The getInfo method returns a IpData opject witch can be used like:
$result->getIpInRequset()

$result->getPassedIp()

$result->getCountry()

$result->getCity()

$result->getCountryCode()

$result->getContinent()

$result->getTimeZone()
  • the getIpInRequset is the ip the request made with

  • the getPassedIp is the ip you provided

  • if they are different this mean the data is for the ip of the machine that sent the request

  • The IpData opject is JsonSerializable .. Find more at THE PHP DOCS.