PHPackages                             itvisionsy/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. itvisionsy/counter

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

itvisionsy/counter
==================

Simple PHP counter

v1.0(9y ago)0261MITPHPPHP &gt;=5.4

Since Oct 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/itvisionsy/php-counter)[ Packagist](https://packagist.org/packages/itvisionsy/counter)[ RSS](/packages/itvisionsy-counter/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

php-counter
===========

[](#php-counter)

Simple counter for PHP

Why needed
----------

[](#why-needed)

Sometimes you need to display a counter steps in a loop where the index of the loop is consumed by a non-serial number.

```
$workHoursLog = [
    '2016-01-01'=>10,
    '2016-01-02'=>10,
    '2016-01-03'=>8,
    //...
];
```

As you can see, the key is not a serial number, any you may want to display in a table:

```

```

result will be

```

        1
        2016-01-01
        10

        2
        2016-01-02
        10

        3
        2016-01-03
        8

```

How to use
----------

[](#how-to-use)

Simply, call the nextOrInit method and pass a unique variable which will hold the counter object, optionally a second parameter which is the start, and a step:

```
\ItvisionSy\Counter\Counter::nextOrInit($counter,[$start=0,[$step=1]]);
```

Or you can initiate

```
//initiate
$counter = new Counter(0,1);
//OR
Counter::nextOrInit($counter, 0, 1);

// get current value
echo $counter;
//OR
echo $counter();
//OR
echo $counter->current();

//next step
$counter->next();
//OR
$counter(true);
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3556d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11ac511b34acf3f7e9a138d3b1a0a868303b376ab991bb176e8ea474857a0e57?d=identicon)[mhh1422](/maintainers/mhh1422)

---

Top Contributors

[![mhh1422](https://avatars.githubusercontent.com/u/499764?v=4)](https://github.com/mhh1422 "mhh1422 (5 commits)")

### Embed Badge

![Health badge](/badges/itvisionsy-counter/health.svg)

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

###  Alternatives

[gburtini/distributions

PHP implementation of a number of statistical probability distributions: normal, beta, gamma, etc.

59524.5k2](/packages/gburtini-distributions)[v17development/flarum-seo

Adds SEO tags for your Flarum forum

4998.7k2](/packages/v17development-flarum-seo)

PHPackages © 2026

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