danilo9/get_ip

Getting information about ip

v1.0 2022-05-30 09:23 UTC

This package is auto-updated.

Last update: 2024-05-22 09:55:33 UTC


README

Getting information about IP

Fields that can be obtained:

  • continent
  • continentCode
  • country
  • countryCode
  • currency
  • regionName
  • city
  • timezone
  • privacy
    • proxy
    • mobile
    • hosting
  • location
    • lat
    • lon
  • zip
  • region
  • isp
  • as
  • asname

Installation

composer require danilo9/get_ip

Documentation

Declare a class:

use Danilo9\GetIp\GetIp;
$getIp = new GetIp();

Options:

$getIp = new GetIp(['lang' => 'ru']);

Get information about ip:

$info = $getIp->process('176.59.134.100');

The default is $_SERVER['REMOTE_ADDR']

Get information

// Returning string
$info->getStatus();
$info->getIp();
$info->getContinent();
$info->getContinentCode();
$info->getCountry();
$info->getCountryCode();
$info->getCurrency();
$info->getRegionName();
$info->getCity();
$info->getTimezone();
$info->getZip();
$info->getRegion();
$info->toJson();
$info->getLocation()->toJson();
$info->getPrivacy()->toJson();
// int
$info->getLocation()->getLat();
$info->getLocation()->getLon();
//bool
$info->getPrivacy()->getMobile();
$info->getPrivacy()->getProxy();
$info->getPrivacy()->getHosting();
// array
$info->toArray();
$info->getLocation()->toArray();
$info->getPrivacy()->toArray();
// jSON
$info->toJson();
$info->getLocation()->toJson();
$info->getPrivacy()->toJson();

License

Apache License 2.0