wdmg/yii2-stats

统计模块

安装: 720

依赖: 1

建议者: 0

安全: 0

星标: 7

关注者: 5

分支: 5

开放问题: 3

类型:yii2-extension

1.3.0 2023-07-06 09:29 UTC

README

Yii2 Downloads Packagist Version Progress GitHub license

Yii2 Stats

Yii2 统计模块

Yii2 的统计模块,该模块考虑了网站访问者的IP、网页浏览器和用户代理的详细信息。此外,该模块允许您统计网站服务器和数据库的负载。

此模块是 Butterfly.СMS 内容管理系统的组成部分,但也可以作为独立扩展使用。

版权(c)2019-2023 W.D.M.Group,乌克兰

要求

安装

要在控制台中安装模块,请运行以下命令

$ composer require "wdmg/yii2-stats"

配置数据库连接后,在控制台中运行以下命令

$ php yii stats/init

然后选择您要执行的操作

  1. 应用所有模块迁移
  2. 撤销所有模块迁移
  3. 更新 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 获取