|
Description | | Author |
This package can find the location of a computer with an IP address.
It provides a component class that extends the Yii2 framework. It sends HTTP requirements to the IPStack Web service API server to get the geographic location of a computer with a given IP address.
The class returns an object with the values of response from the API server like:
- The type of IP address
- Continent code and name
- Country code, name
- Region code and country code
- City name and zip code
- Location latitude, longitude, the state capital, local languages."
- Country flag URL, emoji, phone calling prefix, whether it is in Europe
- Time zone name, code, current time, GMT offset, is daylight saving
- Currency code, name, name in plural, international symbol, local symbol
- Network connection ASN and Internet service provider company name | |
|
Documentation
Yii2 IPStack Client
Locate and identify website visitors by IP address using IPStack API
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist daxslab/yii2-ipstack "*"
or add
"daxslab/yii2-ipstack": "*"
to the require section of your composer.json
file.
Configuration
Add the component to the application:
'components' => [
'ipStack' => [
'class' => \daxslab\ipstack\Client::class,
'api_key' => '{YOUR_API_KEY}',
],
]
Usage
Request info about current user IP
Yii::$app->ipStack->getData();
Request info about a custom IP
Yii::$app->ipStack->getData($ip);