All Projects → chrislim2888 → IP2Location-PHP-Module

chrislim2888 / IP2Location-PHP-Module

Licence: MIT license
This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to IP2Location-PHP-Module

IP2Location-C-Library
IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather station code, weather station name, mobile, usage types, etc that any IP address or hostname originates from.
Stars: ✭ 37 (-75.97%)
Mutual labels:  ipv6, country, timezone, geolocation, domain, ipv4, ip-address, isp, city, elevation, region, ip-lookup, weather-station, ip2location, zip-code, iplocation, area-code, mobile-info
ip2location-nginx
Nginx module that allows user to lookup for geolocation information using IP2Location database.
Stars: ✭ 33 (-78.57%)
Mutual labels:  ipv6, country, geolocation, domain, ipv4, ip-address, isp, city, elevation, region, ip-lookup, ip-location, weather-station, ip2location, zip-code, iplocation, area-code, mobile-info
ipapi-python
Python bindings for https://ipapi.co (IP Address Location) - Use with python / django / flask for IP address location lookup
Stars: ✭ 42 (-72.73%)
Mutual labels:  ipv6, geolocation, ipv4, ip-address, ip-lookup, ip-location
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (-86.36%)
Mutual labels:  ipv6, geolocation, ipv4, ip-address
IPpy
🚀 Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Stars: ✭ 54 (-64.94%)
Mutual labels:  ipv6, domain, ipv4, ip-address
node-ip2region
IP/IPv6 to region on Node.js (IP/IPv6 地址到区域运营商)
Stars: ✭ 95 (-38.31%)
Mutual labels:  ipv6, ip-address, ip-lookup, ip-location
php-ip-anonymizer
IP address anonymizer library for PHP
Stars: ✭ 55 (-64.29%)
Mutual labels:  ipv6, ipv4, ip-address
PHP-IPAddress
IP Address utility classes for PHP
Stars: ✭ 63 (-59.09%)
Mutual labels:  ipv6, ipv4, ip-address
hphr
Halophile Router (a VyOS-based, SaltStack-automated, NetBox-configured router for small provider networks)
Stars: ✭ 39 (-74.68%)
Mutual labels:  ipv6, ipv4, isp
Ip Num
A TypeScript/JavaScript library for working with ASN, IPv4, and IPv6 numbers. It provides representations of these internet protocol numbers with the ability to perform various IP related operations like parsing, validating etc. on them
Stars: ✭ 113 (-26.62%)
Mutual labels:  ipv6, ipv4, ip-address
ip
Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
Stars: ✭ 212 (+37.66%)
Mutual labels:  ipv6, ipv4, ip-address
Ipnetwork
A library to work with CIDRs in rust
Stars: ✭ 64 (-58.44%)
Mutual labels:  ipv6, ipv4, ip-address
ip2location-cakephp
IP2Location CakePHP plugin enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, IP address type and IAB advertising category from IP address using IP2Location database.
Stars: ✭ 17 (-88.96%)
Mutual labels:  geolocation, ip-lookup, ip2location
ipv6
IPv6-adresse.dk source & data
Stars: ✭ 27 (-82.47%)
Mutual labels:  ipv6, ipv4, isp
Ipwhois
Retrieve and parse whois data for IPv4 and IPv6 addresses
Stars: ✭ 432 (+180.52%)
Mutual labels:  ipv6, ipv4, ip-address
go-inet
A Go library for reading, formatting, sorting, lookup and converting IP-addresses and IP-blocks
Stars: ✭ 14 (-90.91%)
Mutual labels:  ipv6, ipv4, ip-lookup
Laravel World
provide countries, states, and cities relations and database.
Stars: ✭ 222 (+44.16%)
Mutual labels:  country, city, region
private-ip
Check if IP address is private.
Stars: ✭ 26 (-83.12%)
Mutual labels:  ipv6, ipv4, ip-address
ipaddress
Data analysis of IP addresses and networks
Stars: ✭ 20 (-87.01%)
Mutual labels:  ipv6, ipv4, ip-address
Ipaddress
Java library for handling IP addresses and subnets, both IPv4 and IPv6
Stars: ✭ 197 (+27.92%)
Mutual labels:  ipv6, ipv4, ip-address

IP2Location (PHP Module)

Latest Stable Version Total Downloads

This is the official release maintained by IP2Location.com

This PHP module provides fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection speed, IDD code, area code, weather station code, weather station name, MNC, MCC, mobile brand, elevation, usage type, address type and IAB category from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com.

This module can be used in many types of projects such as:

  1. select the geographically closest mirror
  2. analyze your web server logs to determine the countries of your visitors
  3. credit card fraud detection
  4. software export controls
  5. display native language and currency
  6. prevent password sharing and abuse of service
  7. geotargeting in advertisement

Free IP2Location LITE and commerical databases are available for download.

Monthly update is available for both IP2Location LITE and commercial database.

KEY FEATURES

  1. Support both IPv4 and IPv6 with ease. If you would like to enable IPv6 support, you just need to replace your BIN file with IPv6 version. That's it, and no code modification needed.
  2. Extensible. If you require different granularity of IP information, you can visit IP2Location.com to download the relevant BIN file, and the information will made ready for you.
  3. Comprehensive Information. There are more than 13 types of information that you can retrieve from an IP address. Please visit IP2Location.com for details.

INSTALLATION

Install this package using composer as below:

composer require ip2location/ip2location-php

To test this installation, please browse examples/example.php using web browser.

USAGE

You can check the example.php file to learn more about usage.

Database Class

Below is the description of the functions available in the Database class.

Function Name Description
Constructor Expect 2 input parameters:
  1. Full path of IP2Location BIN data file.
  2. File Open Mode
    • SHARED_MEMORY
    • MEMORY_CACHE
    • FILE_IO
For SHARED_MEMORY and MEMORY_CACHE, it will require your server to have sufficient memory to hold the BIN data, otherwise it will raise the errors during the object initialization.
string getDate() Return the database's compilation date as a string of the form 'YYYY-MM-DD'
string getType() Return the database's type, 1 to 25 respectively for DB1 to DB25. Please visit https://www.ip2location.com/databases for details.
string getModuleVersion() Return the version of module
string getDatabaseVersion() Return the version of database
array lookup($ip) Return the IP information in array. Below is the information returned:
  • ipNumber
  • ipVersion
  • ipAddress
  • countryCode
  • countryName
  • regionName
  • cityName
  • latitude
  • longitude
  • areaCode
  • iddCode
  • weatherStationCode
  • weatherStationName
  • mcc
  • mnc
  • mobileCarrierName
  • usageType
  • elevation
  • netSpeed
  • timeZone
  • zipCode
  • domainName
  • isp
  • addressType
  • category
You can visit IP2Location for the description of each field. Note: although the above names are not exactly matched with the names given in this link, but they are self-described.
array getCidr($ip) Return an array of the complete IP list in CIDR format of the detected row record based on the given IP address.

WebService Class

Below is the description of the functions available in the WebService class.

Function Name Description
Constructor Expect 3 input parameters:
  1. IP2Location API Key.
  2. Package (WS1 - WS25)
  3. Use HTTPS or HTTP
array lookup($ip) Return the IP information in array.
  • country_code
  • country_name
  • region_name
  • city_name
  • latitude
  • longitude
  • zip_code
  • time_zone
  • isp
  • domain
  • net_speed
  • idd_code
  • area_code
  • weather_station_code
  • weather_station_name
  • mcc
  • mnc
  • mobile_brand
  • elevation
  • usage_type
  • address_type
  • category
  • continent
    • name
    • code
    • hemisphere
    • translations
  • country
    • name
    • alpha3_code
    • numeric_code
    • demonym
    • flag
    • capital
    • total_area
    • population
    • currency
      • code
      • name
      • symbol
    • language
      • code
      • name
    • idd_code
    • tld
    • translations
  • region
    • name
    • code
    • translations
  • city
    • name
    • translations
  • geotargeting
    • metro
  • country_groupings
  • time_zone_info
    • olson
    • current_time
    • gmt_offset
    • is_dst
    • sunrise
    • sunset
    int getCredit() Return remaining credit of the web service account.

    IpTools Class

    Below is the description of the functions available in the IpTools class.

    Function Name Description
    bool isIpv4($ip) Return either true or false. Verify if a string is a valid IPv4 address.
    bool isIpv6($ip) Return either true or false. Verify if a string is a valid IPv6 address.
    mixed ipv4ToDecimal($ip) Translate IPv4 address from dotted-decimal address to decimal format. Return null on error.
    mixed decimalToIpv4($number) Translate IPv4 address from decimal number to dotted-decimal address. Return null on error.
    mixed ipv6ToDecimal($ip) Translate IPv6 address from hexadecimal address to decimal format. Return null on error.
    mixed decimalToIpv6($number) Translate IPv6 address from decimal number into hexadecimal address. Return null on error.
    array ipv4ToCidr($ipFrom, $ipTo) Convert IPv4 range into a list of IPv4 CIDR notation.
    array cidrToIpv4($cidr) Convert IPv4 CIDR notation into a list of IPv4 addresses.
    array ipv6ToCidr($ipFrom, $ipTo) Convert IPv6 range into a list of IPv6 CIDR notation.
    array cidrToIpv6($cidr) Convert IPv6 CIDR notation into a list of IPv6 addresses.
    string compressIpv6($ipv6) Compress a IPv6 to shorten the length.
    string expandIpv6($ipv6) Expand a shorten IPv6 to full length.

    Country Class

    Below is the description of the functions available in the Country class.

    Function Name Description
    Constructor Expect a IP2Location Country Information CSV file. This database is free for download at https://www.ip2location.com/free/country-information
    array getCountryInfo($countryCode) Provide a ISO 3166 country code to get the country information in array. Will return a full list of countries information if country code not provided. Below is the information returned:
    • country_code
    • country_alpha3_code
    • country_numeric_code
    • capital
    • country_demonym
    • total_area
    • population
    • idd_code
    • currency_code
    • currency_name
    • currency_symbol
    • lang_code
    • lang_name
    • cctld

    DEPENDENCIES

    This library requires IP2Location BIN data file to function. You may download the BIN data file at

    An outdated BIN database was provided in the databases folder for your testing. You are recommended to visit the above links to download the latest BIN database.

    You can also sign up for IP2Location Web Service to lookup by IP2Location API.

    IPv4 BIN vs IPv6 BIN

    • Use the IPv4 BIN file if you just need to query IPv4 addresses.
    • Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.

    OTHER FRAMEWORK LIBRARY

    Below are the list of other framework library that you can install and use right away.

    COPYRIGHT AND LICENSE

    Copyright (C) 2005-2021 by IP2Location.com

    License under MIT

    Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].