wdmg / yii2-stats
统计模块
1.3.0
2023-07-06 09:29 UTC
Requires
- php: >=5.4
- geoip2/geoip2: ~2.0
- wdmg/yii2-base: ^1.3.0
- wdmg/yii2-chartjs: ^1.0.7
- wdmg/yii2-datepicker: ^1.1.0
- wdmg/yii2-helpers: ^1.4.3
- wdmg/yii2-selectinput: ^1.0.9
- wdmg/yii2-validators: ^1.0.6
- yiisoft/yii2: ^2.0.40
README
Yii2 统计模块
Yii2 的统计模块,该模块考虑了网站访问者的IP、网页浏览器和用户代理的详细信息。此外,该模块允许您统计网站服务器和数据库的负载。
此模块是 Butterfly.СMS 内容管理系统的组成部分,但也可以作为独立扩展使用。
版权(c)2019-2023 W.D.M.Group,乌克兰
要求
- PHP 5.6 或更高版本
- Yii2 v.2.0.40 及以上
- Yii2 Base 模块(必需)
- Yii2 ChartJS 小部件
- Yii2 SelectInput 小部件
- GeoIP2 PHP API
- Yii2 Users 模块(可选)
安装
要在控制台中安装模块,请运行以下命令
$ composer require "wdmg/yii2-stats"
配置数据库连接后,在控制台中运行以下命令
$ php yii stats/init
然后选择您要执行的操作
- 应用所有模块迁移
- 撤销所有模块迁移
- 更新 MaxMind GeoLite2 数据库
迁移
在任何情况下,您都可以通过在控制台中运行以下命令来执行迁移
$ php yii migrate --migrationPath=@vendor/wdmg/yii2-stats/migrations
配置
要将模块添加到项目中,请将以下数据添加到您的配置文件中
'modules' => [
...
'stats' => [
'class' => 'wdmg\stats\Module',
'collectStats' => true,
'collectProfiling' => true,
'detectLocation' => false,
'routePrefix' => 'admin',
'storagePeriod' => 0,
'ignoreDev' => true,
'ignoreAjax' => true,
'useChart' => true,
'ignoreRoute' => ['/admin', '/admin/'],
'ignoreListIp' => ['::1', '127.0.0.1'],
'ignoreListUA' => [],
'cookieName' => 'yii2_stats',
'cookieExpire' => 3110400,
'maxmindLicenseKey' => false,
'advertisingSystems' => ["gclid", "yclid", "fbclid", ...],
'socialNetworks' => ["facebook", "instagram", "twitter", ...],
'searchEngines' => ["google", "yandex", "yahoo", ...],
'clientPlatforms' => [
'/windows nt 10/i' => [
'title' => 'Windows 10',
'icon' => 'icon-win-10-os'
],
...
],
'clientBrowsers' => [
'/msie/i' => [
'title' => 'Internet Explorer',
'icon' => 'icon-ie-browser'
],
...
]
],
...
],
选项
路由
使用模块的 Module::dashboardNavItems() 方法生成用于 NavBar 的导航项目列表,如下所示
<?php
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'label' => 'Modules',
'items' => [
Yii::$app->getModule('stats')->dashboardNavItems(),
...
]
]);
?>
状态和版本 [可用]
- v.1.3.0 - 更新版权,修复导航菜单
- v.1.2.5 - RBAC 实现
- v.1.2.4 - 更新 README.md
版权和许可证
本产品还包括由 MaxMind 创建的 GeoLite2 数据,可在 https://www.maxmind.com 获取
