IP2Location Yii extension enables the user to find the country, region, city, coordinates, zip code, time zone, ISP

Overview

IP2Location Yii extension

IP2Location Yii extension 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. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location BIN databases or web service for applications written using Yii.

INSTALLATION

For Yii2

  1. Run the command: php composer.phar require ip2location/ip2location-yii to download the extension into the Yii2 framework.
  2. Download latest IP2Location BIN database
  3. Unzip and copy the BIN file into the Yii2 framework.

Note: The BIN database refers to the binary file ended with .BIN extension, but not the CSV format. Please select the right package for download.

USAGE

use IP2LocationYii\IP2Location_Yii;

// (required) Define IP2Location database path.
define('IP2LOCATION_DATABASE', '/path/to/ip2location/database');

// (required) Define IP2Location API key.
define('IP2LOCATION_API_KEY', 'your_api_key');

// (required) Define IP2Location Web service package of different granularity of return information.
define('IP2LOCATION_PACKAGE', 'WS1');

// (optional) Define to use https or http.
define('IP2LOCATION_USESSL', false);

// (optional) Define extra information in addition to the above-selected package. Refer to https://www.ip2location.com/web-service/ip2location for the list of available addons.
define('IP2LOCATION_ADDONS', []);

// (optional) Define Translation information. Refer to https://www.ip2location.com/web-service/ip2location for available languages.
define('IP2LOCATION_LANGUAGE', 'en');

$IP2Location = new IP2Location_Yii();

$record = $IP2Location->get('8.8.8.8');
echo 'Result from BIN Database:
'; echo 'IP Address: ' . $record['ipAddress'] . '
'; echo 'IP Number: ' . $record['ipNumber'] . '
'; echo 'ISO Country Code: ' . $record['countryCode'] . '
'; echo 'Country Name: ' . $record['countryName'] . '
'; echo 'Region Name: ' . $record['regionName'] . '
'; echo 'City Name: ' . $record['cityName'] . '
'; echo 'Latitude: ' . $record['latitude'] . '
'; echo 'Longitude: ' . $record['longitude'] . '
'; echo 'ZIP Code: ' . $record['zipCode'] . '
'; echo 'Time Zone: ' . $record['timeZone'] . '
'; echo 'ISP Name: ' . $record['isp'] . '
'; echo 'Domain Name: ' . $record['domainName'] . '
'; echo 'Net Speed: ' . $record['netSpeed'] . '
'; echo 'IDD Code: ' . $record['iddCode'] . '
'; echo 'Area Code: ' . $record['areaCode'] . '
'; echo 'Weather Station Code: ' . $record['weatherStationCode'] . '
'; echo 'Weather Station Name: ' . $record['weatherStationName'] . '
'; echo 'MCC: ' . $record['mcc'] . '
'; echo 'MNC: ' . $record['mnc'] . '
'; echo 'Mobile Carrier Name: ' . $record['mobileCarrierName'] . '
'; echo 'Elevation: ' . $record['elevation'] . '
'; echo 'Usage Type: ' . $record['usageType'] . '
'; echo 'Address Type: ' . $record['addressType'] . '
'; echo 'Category: ' . $record['category'] . '
'; $record = $IP2Location->getWebService('8.8.8.8'); echo 'Result from Web service:
'; echo '
';
print_r ($record);
echo '
';

DEPENDENCIES

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

You can also sign up for IP2Location Web Service to get one free API key.

SUPPORT

Email: [email protected]

Website: https://www.ip2location.com

You might also like...
Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager

Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager (CAuthManager). You can read more about Yii's authorization manager in the framework documentation under Authentication and Authorization.

Free ZIP Code API - Free Access to Worldwide Postal Code Data

About Zipcodebase - Free Zip Code API Zipcodebase is a zip code API that was founded in 2019 to solve common issues with postal code data. As we have

A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

Ubilling is opensource ISP billing system based on stargazer

Ubilling Ubilling is opensource ISP billing system based on stargazer. Please visit our official resources: Project homepage Documentation Community f

A hacky PHP script to download posts, images, videos and framework grading from Parent Zone

ParentZoneDownloader A hacky PHP script to download posts, images, videos and framework grading from Parent Zone Pre-Requisites Tested on PHP 7.4, but

Tool for easy selection and export of user files in ZIP format.

Personal data export Idea Tool for easy selection and export of user files in ZIP format. Within a single selector, you choose all user data (much of

Official repository for Find A PR. Find A PR is a platform that curates a list of issues around Laravel based project.

About Find A PR This is the official repository for Find A PR. Find A PR is a platform that curates a list of issues around Laravel based project. Req

A Laravel package to get the user's country using the ip.

Laravel IP Service Tries to guess the country code of the client, using his IP. Installation Download and import the ip database from ip2nation.com Us

CaraCracha - a captive portal project made for ISPs on my old city

CaraCracha - a captive portal project made for ISPs on my old city, Sobradinho, state of Bahia, Brazil. I found its code recently and hope it could be useful for someone.

This script allows to bypass Oracle Cloud Infrastructure 'Out of host capacity' error immediately when additional OCI capacity will appear in your Home Region / Availability domain.
This script allows to bypass Oracle Cloud Infrastructure 'Out of host capacity' error immediately when additional OCI capacity will appear in your Home Region / Availability domain.

Resolving Oracle Cloud "Out of Capacity" issue and getting free VPS with 4 ARM cores / 24GB of memory Very neat and useful configuration was recently

Where we build an open source API to retrieve some data about Togo's region

🇹🇬 Subdivision administrative du Togo Base de données complète des régions, préfectures, communes, cantons et quartiers disponible au format JSON, S

Example of using TALL stack to select country phone code.
Example of using TALL stack to select country phone code.

Select country phone code using TALL stack About Example of using TALL stack to select country phone code. Each item represents a country. Each item h

The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

SensioLabs DeprecationDetector CAUTION: This package is abandoned and will no longer receive any updates. The SensioLabs DeprecationDetector runs a st

An extension that enables the SQLite DB

SQLite on MediaWiki This extension is based on a WIP in the WMF’s gerrit. How to use it Put the following in your composer.local.json: { "require": {

Simple solution for converting excel rows into coordinates using Google Maps API

Package Usage Start by creating a new instance of ExcelToCoorindates class: $excel_to_cordinates = new ExcelToCoordinates(); Methods -setEx

Use: [i] to share item and name in hand, [coor] to share you current coordinates

General Now you can share your Coordinates and Item with Prefix Example if you type [i] in message, later it will be automatically replaced into the n

Main component controls and coordinates saga participants
Main component controls and coordinates saga participants

Saga Orchestrator Table Of Contents Introduction Requirements About package Installation Getting started Configuration Saga creation Internal License

Releases(1.0.0)
Owner
IP2Location
IP geolocation solution. Determine geographical location information such as county, city, zipcode, mobile network information by IP address.
IP2Location
A Laravel package to get the user's country using the ip.

Laravel IP Service Tries to guess the country code of the client, using his IP. Installation Download and import the ip database from ip2nation.com Us

Dimitris Savvopoulos 119 Nov 29, 2022
Simple solution for converting excel rows into coordinates using Google Maps API

Package Usage Start by creating a new instance of ExcelToCoorindates class: $excel_to_cordinates = new ExcelToCoordinates(); Methods ->setEx

Nikola Cirkovic 2 Oct 16, 2021
Use: [i] to share item and name in hand, [coor] to share you current coordinates

General Now you can share your Coordinates and Item with Prefix Example if you type [i] in message, later it will be automatically replaced into the n

ItsRealNise 7 Oct 15, 2021
PHP extension for geospatial rendering with Mapnik

PHP7 Mapnik Introduction This project is an extension for PHP 7 that enables geospatial rendering with Mapnik. Create tile generation scripts, dynamic

Garrett Johnson 20 Dec 14, 2022
PHP Extension to handle common geospatial functions.

geospatial - PHP Geospatial Extension PHP Extension to handle common geospatial functions. The extension currently has implementations of the Haversin

PHP Geospatial, putting the Elephpant on your globe 56 Dec 29, 2022
Looks up which function or method a line of code belongs to

sebastian/code-unit-reverse-lookup Looks up which function or method a line of code belongs to. Installation You can add this library as a local, per-

Sebastian Bergmann 6.4k Dec 29, 2022
List of France cities with zip codes, department codes, region codes, districts for former cities, GPS latitude longitude coordinates, and INSEE reference code.

List of France cities with zip codes, department codes, region codes, districts for former cities, GPS latitude longitude coordinates, and INSEE reference code.

Coercive 4 May 25, 2022
GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn

GeoLocation in PHP (API) ?? ?? ?? This package helps you to know a lot of information about the current user by his ip address ?? ?? ?? This package h

Abdullah Karam 4 Dec 8, 2022
Geographer is a PHP library that knows how any country, state or city is called in any language

Geographer Geographer is a PHP library that knows how any country, state or city is called in any language. Documentation on the official website Incl

Menara Solutions 757 Nov 24, 2022