PHPackages                             dykyi-roman/online-visitors-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. dykyi-roman/online-visitors-counter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dykyi-roman/online-visitors-counter
===================================

Online visitors counter

0451PHP

Since Oct 1Pushed 8y agoCompare

[ Source](https://github.com/dykyi-roman/online-visitors-counter)[ Packagist](https://packagist.org/packages/dykyi-roman/online-visitors-counter)[ RSS](/packages/dykyi-roman-online-visitors-counter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

online-visitors-counter
=======================

[](#online-visitors-counter)

1. First we need a MySQL table to store our information

```
CREATE TABLE online_visitors(
	session_id CHAR(100) NOT NULL DEFAULT '',
	time INT(11) NOT NULL DEFAULT '0'
);
```

or use Redis.

2. We are checking if the session has been already started, if it's not, then start the session
3. We created two variables, one is the current time and the other contains the current time minus n minutes
4. We need to check the session\_id is already stored or not, so we query the database and see if it doesn't exist, then we'll store it and if it does exist, we will update the session's time in the DB
5. We get the count of the total session
6. We then check if the session has been in the database for more than 10 minutes, if it is, then we will delete it.

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

[](#installation)

### Composer

[](#composer)

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

Either run

```
composer require dykyi-roman/online-visitors-counter "dev-master"

```

or add

```
"dykyi-roman/online-visitors-counter": "master"

```

to the require section of your `composer.json`

Driver Support
--------------

[](#driver-support)

- Redis
- Mysql

Plans for the future
--------------------

[](#plans-for-the-future)

- Support MSSQL Driver
- Support Memcached Driver

Usage
-----

[](#usage)

```
use Dykyi\Driver\MySQLDB;
use Dykyi\DBFactory;
use Dykyi\VisitorsCounter;

$dbFactory = new DBFactory();
$dbFactory->setDriver(MySQLDB::class);
$dataBase   = $dbFactory->makeDB(['127.0.0.1','homestead','homestead','secret']);
$repository = $dbFactory->getRepository($dataBase);
echo VisitorsCounter::getCount($repository);
```

Author
------

[](#author)

[Dykyi Roman](https://www.linkedin.com/in/roman-dykyi-43428543/), e-mail:

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5338cd2352194c8a305853a69f338b4549b4b6c6beb159b26684392c205ddb24?d=identicon)[dikiy-roman](/maintainers/dikiy-roman)

---

Top Contributors

[![dykyi-roman](https://avatars.githubusercontent.com/u/29334048?v=4)](https://github.com/dykyi-roman "dykyi-roman (3 commits)")

### Embed Badge

![Health badge](/badges/dykyi-roman-online-visitors-counter/health.svg)

```
[![Health](https://phpackages.com/badges/dykyi-roman-online-visitors-counter/health.svg)](https://phpackages.com/packages/dykyi-roman-online-visitors-counter)
```

PHPackages © 2026

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