PHPackages                             wdmg/yii2-stats - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wdmg/yii2-stats

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

wdmg/yii2-stats
===============

Statistic module

1.3.0(2y ago)77686[3 issues](https://github.com/wdmg/yii2-stats/issues)1MITPHPPHP &gt;=5.4

Since Feb 9Pushed 2y ago4 watchersCompare

[ Source](https://github.com/wdmg/yii2-stats)[ Packagist](https://packagist.org/packages/wdmg/yii2-stats)[ Docs](https://github.com/wdmg/yii2-stats)[ RSS](/packages/wdmg-yii2-stats/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (8)Versions (28)Used By (1)

[![Yii2](https://camo.githubusercontent.com/3f29058a9886ae3e9efc09df82d551051f8ea6c8da1176d9e8ca8a64be6f9b40/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72657175697265642d596969325f76322e302e34302d626c75652e737667)](https://packagist.org/packages/yiisoft/yii2)[![Downloads](https://camo.githubusercontent.com/52e85afc8da92d0a0773c93872e9c6c46888a8eb839182826fe6033553a03c50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77646d672f796969322d73746174732e737667)](https://packagist.org/packages/wdmg/yii2-stats)[![Packagist Version](https://camo.githubusercontent.com/787916915e771f189ff25e4ad9f528ea624065ea92909b22e930cc43afb6d27d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77646d672f796969322d73746174732e737667)](https://packagist.org/packages/wdmg/yii2-stats)[![Progress](https://camo.githubusercontent.com/d2c102b075c16f8a841e697b04c43bc93c8d092c5795ad8b3090d7fa993c258a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f67726573732d72656164795f746f5f7573652d677265656e2e737667)](https://camo.githubusercontent.com/d2c102b075c16f8a841e697b04c43bc93c8d092c5795ad8b3090d7fa993c258a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f67726573732d72656164795f746f5f7573652d677265656e2e737667)[![GitHub license](https://camo.githubusercontent.com/885e384eebebd8876119cf393b2fca722bc53c8b1e8ff8ba696e035b25885983/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77646d672f796969322d73746174732e737667)](https://github.com/wdmg/yii2-stats/blob/master/LICENSE)

[![Yii2 Stats](./docs/images/yii2-stats.png)](./docs/images/yii2-stats.png)

Yii2 Statistics Module
======================

[](#yii2-statistics-module)

Statistics module for Yii2. The module takes into account site visitors with details on IP, web browser and user agent. In addition, the module allows you to keep statistics of the load on the web server and database.

This module is an integral part of the [Butterfly.СMS](https://butterflycms.com/) content management system, but can also be used as an standalone extension.

Copyrights (c) 2019-2023 [W.D.M.Group, Ukraine](https://wdmg.com.ua/)

Requirements
============

[](#requirements)

- PHP 5.6 or higher
- Yii2 v.2.0.40 and newest
- [Yii2 Base](https://github.com/wdmg/yii2-base) module (required)
- [Yii2 ChartJS](https://github.com/wdmg/yii2-chartjs) widget
- [Yii2 SelectInput](https://github.com/wdmg/yii2-selectinput) widget
- [GeoIP2 PHP API](https://github.com/maxmind/GeoIP2-php)
- [Yii2 Users](https://github.com/wdmg/yii2-users) module (optionaly)

Installation
============

[](#installation)

To install the module, run the following command in the console:

`$ composer require "wdmg/yii2-stats"`

After configure db connection, run the following command in the console:

`$ php yii stats/init`

And select the operation you want to perform:

1. Apply all module migrations
2. Revert all module migrations
3. Update MaxMind GeoLite2 database

Migrations
==========

[](#migrations)

In any case, you can execute the migration run the following command in the console:

`$ php yii migrate --migrationPath=@vendor/wdmg/yii2-stats/migrations`

Configure
=========

[](#configure)

To add a module to the project, add the following data in your configuration file:

```
'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'
            ],
            ...
        ]
    ],
    ...
],

```

Options
=======

[](#options)

NameTypeDefaultDescriptioncollectStatsboolean`true`Collect statistics with this module?detectLocationboolean`false`Detect GEO location by IP?routePrefixstring'admin'Route prefix to the module control panel.storagePeriodinteger0Days, how many to store statistics. 0 - infinity.useChartboolean`true`Use charts when displaying statistics.ignoreDevboolean`true`Ignore activity in development mode.ignoreAjaxboolean`true`Ignoring activity for Ajax requests.ignoreRoutearray\['/admin'\]Ignoring the activity at the specified routing.ignoreListIparray\['127.0.0.1'\]Ignoring activity from specified IP addresses.ignoreListUAarray\[...\]Ignoring of activity at specified UserAgents.cookieNamestring'yii2\_stats'The name of the cookie to store the visit ID.cookieExpireinteger3110400Cookie lifetime.maxmindLicenseKeymixed`false`MaxMind LicenseKey for GeoLite2 databases.advertisingSystemsarray\[...\]List to detect the transition from advertising sites.socialNetworksarray\[...\]List for detecting transition from social networks.searchEnginesarray\[...\]List for detecting the transition from search engines.clientPlatformsarray\[...\]List for detecting the client's OS.clientBrowsersarray\[...\]Client's Browser detection list.Routing
=======

[](#routing)

Use the `Module::dashboardNavItems()` method of the module to generate a navigation items list for NavBar, like this:

```

```

Status and version \[ready to use\]
===================================

[](#status-and-version-ready-to-use)

- v.1.3.0 - Update copyrights, fix nav menu
- v.1.2.5 - RBAC implementation
- v.1.2.4 - Update README.md

Copyright and License
=====================

[](#copyright-and-license)

This product also includes GeoLite2 data created by MaxMind, available from

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~61 days

Recently: every ~291 days

Total

27

Last Release

1041d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1635637?v=4)[Alexsander Vyshnyvetskyy](/maintainers/alex-wdmg)[@alex-wdmg](https://github.com/alex-wdmg)

---

Top Contributors

[![alex-wdmg](https://avatars.githubusercontent.com/u/1635637?v=4)](https://github.com/alex-wdmg "alex-wdmg (109 commits)")

---

Tags

yii2statsstatisticswdmgyii2-stats

### Embed Badge

![Health badge](/badges/wdmg-yii2-stats/health.svg)

```
[![Health](https://phpackages.com/badges/wdmg-yii2-stats/health.svg)](https://phpackages.com/packages/wdmg-yii2-stats)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
