pendalf89/yii2-clientinfo
最新稳定版本:1.0.1
Composer 安装命令:
composer require pendalf89/yii2-clientinfo
包简介
Yii2 client info component, that detects real client IP address and device type
README 文档
README
The component provides a convenient way to retrieve information from the client (user), including the IP address, country, and device. It's very fast thanks to caching. Mobile Detect library is used to determine the type of device. The Sypex Geo database is used to determine the country by IP address.
Installation
The preferred way to install this extension is through composer.
Either run
composer require pendalf89/yii2-clientinfo
or add
"pendalf89/yii2-clientinfo": "^1.0.0"
to the require section of your composer.json file.
Configuration
'components' => [ 'clientInfo' => 'pendalf89\clientinfo\ClientInfo', ],
You also can add DocBlock into Yii.php file for IDE autocompleting.
/** * Class WebApplication * Include only Web application related components here * * @property pendalf89\clientinfo\ClientInfo $clientInfo */ class WebApplication extends yii\web\Application { }
Usage
It's very easy to use:
$isMobile = Yii::$app->clientInfo->isMobile(); $ip = Yii::$app->clientInfo->getIP(); $country = Yii::$app->clientInfo->getCountry(); $isFinland = Yii::$app->clientInfo->isCountry('FI');
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-22