PHPackages                             coderius/yii2-hit-counter - 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. coderius/yii2-hit-counter

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

coderius/yii2-hit-counter
=========================

yii2 hit counter

1.0.2.2(6y ago)74.2k↓12.5%8[2 PRs](https://github.com/coderius/yii2-hit-counter/pulls)MITPHPPHP &gt;=5.6.0CI failing

Since Dec 16Pushed 3y ago2 watchersCompare

[ Source](https://github.com/coderius/yii2-hit-counter)[ Packagist](https://packagist.org/packages/coderius/yii2-hit-counter)[ RSS](/packages/coderius-yii2-hit-counter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

Yii2 hit counter extention
==========================

[](#yii2-hit-counter-extention)

[![Software License](https://camo.githubusercontent.com/4755b180f1a2d9559a4012dcf00c7e806dc165773d1ee805d5760443f513736a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6465726975732f796969322d6869742d636f756e746572)](LICENSE.md)[![Code Coverage](https://camo.githubusercontent.com/c02d9984a072cf6da698bfdd743be1f93037e693188cd162f1886e060291fadd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6465726975732f796969322d6869742d636f756e7465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/coderius/yii2-hit-counter/?branch=master)[![Code Intelligence Status](https://camo.githubusercontent.com/fcd7c8acb929f4daf100cefad133d065f4a28bea800a81c7f59ef929e90bd0f3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6465726975732f796969322d6869742d636f756e7465722f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)[![Code Quality](https://camo.githubusercontent.com/170e73a0dd868bd2f994f3e6c534a43d85b132eeac42e414004bbf0b47fa0e6a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f636f6465726975732f796969322d6869742d636f756e7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/coderius/yii2-hit-counter/?branch=master)[![CodeFactor](https://camo.githubusercontent.com/74df7c86f4892803e994fe10266b899e1f55a6b711afa8111c83a900a865ccb1/68747470733a2f2f696d672e736869656c64732e696f2f636f6465666163746f722f67726164652f6769746875622f636f6465726975732f796969322d6869742d636f756e746572)](https://www.codefactor.io/repository/github/coderius/yii2-hit-counter)[![Build Status](https://camo.githubusercontent.com/16e04c41af7d6f71529f9cad3db03a9b412f5e7ebf47bd66b949440d53f8a208/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6465726975732f796969322d6869742d636f756e7465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/coderius/yii2-hit-counter/build-status/master)

About extention
---------------

[](#about-extention)

This extension allows you to organize the collection of data about website visitors. Data is stored in a database.

**What visitor data is collected**

Javascript and php are used to get information about visitors:

By Javascript:

- Detect if client cookie enabled
- Detect if java enabled
- Detect if client has totuch device
- Timezone offset
- Type connection (like 4g etc.)
- Current url
- Referer url
- Client screen width
- Client screen height
- Client color depth
- Client browser language
- Client history length
- Client processor ram

By php:

- Visitor ip address
- Visitor user agent
- Visitor referer url
- Server name
- Auth user id
- Port
- Cookies http
- Os
- Client info
- Client device type (desctop etc.)
- Device brand
- Client device model (if detect)
- Detect is bot
- Host by ip
- Is proxy or vpn
- Date and time visit

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

First download module . Run the command in the terminal:

```
composer require "coderius/yii2-hit-counter"

```

or add in composer.json

```
"coderius/yii2-hit-counter": "^1.0"

```

and run `composer update`

Run migrations in root folder project:

```
php yii migrate/to m190926_110717_hit_counter__table --migrationPath=@coderius/hitCounter/migrations

```

Usage
-----

[](#usage)

Include module in app config file. In [advanced template](https://github.com/yiisoft/yii2-app-advanced) go to `common/main.php` and set to config array next params:

```
    $conf = [
        ...
    ];

    $conf['modules']['hitCounter'] = [
            'class' => 'coderius\hitCounter\Module',
        ];

    $conf['bootstrap'][] = 'coderius\hitCounter\config\Bootstrap';

```

In view file past hit counter widget:
-------------------------------------

[](#in-view-file-past-hit-counter-widget)

```

```

Testing
-------

[](#testing)

For tests neded test database and tables. Documentation about creating test db is at [tests/\_app/README.md](tests/_app/README.md).

In order to run the tests you need to do the following:

- Set alias in terminal to phpunit:

```
alias phpunit="/var/www/html/yii2-hit-counter/vendor/bin/phpunit"

```

- Go to root folder module 'yii2-hit-counter' in terminal and run tests:

```
phpunit

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~0 days

Total

5

Last Release

2345d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f44111a0ca7b41e84140cc1bb8c6d89e2a2368384348d2d511d36074f8451e3f?d=identicon)[coderius](/maintainers/coderius)

---

Top Contributors

[![coderius](https://avatars.githubusercontent.com/u/36597893?v=4)](https://github.com/coderius "coderius (95 commits)")

---

Tags

analitycshitcounterhitsmodulevisitor-counteryii2yii2-extensionyii2-modulesyii2moduleyii2-extensionhitsyii2 modulesanalitycshit countervisitor-counter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/coderius-yii2-hit-counter/health.svg)

```
[![Health](https://phpackages.com/badges/coderius-yii2-hit-counter/health.svg)](https://phpackages.com/packages/coderius-yii2-hit-counter)
```

###  Alternatives

[branchonline/yii2-lightbox

Lightbox widget for Yii2

13139.0k1](/packages/branchonline-yii2-lightbox)[akiraz2/yii2-ticket-support

Yii2 Support Ticket Module, easy, flexible, fast

611.7k](/packages/akiraz2-yii2-ticket-support)

PHPackages © 2026

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