PHPackages                             dashifen/modcount - 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. dashifen/modcount

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

dashifen/modcount
=================

an object that produces a series of numbers over and over again

1.0.3(6y ago)06MITPHPPHP &gt;=7.3

Since Apr 19Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

Dashifen/Modcount
=================

[](#dashifenmodcount)

Sometimes it's handy to have a way to produce a sequence of numbers that repeats from zero to some number N. Primarily, this is useful for accessing an array over and over again if you have the need to do so.

Usage
-----

[](#usage)

```
$modcount = new Modcount(3);
echo $modcount->count();        // produces 0
echo $modcount->count();        // produces 1
echo $modcount->count();        // produces 2
echo $modcount->count();        // produces 0
echo $modcount->count();        // produces 1

```

You can also do all of that like this if you prefer:

```
$modcount = new Modcount(3);
echo $modcount();
echo $modcount();
echo $modcount();

```

So, why would I use this?
-------------------------

[](#so-why-would-i-use-this)

It's entirely possible that no one other than Dash ever will. That's okay, he loves it. His primary need for it is the repetitious printing of HTML table cell `headers` attribute values in a loop:

```
$users = $database->getUsers();
$cols  = ["id", "name", "email", "phone"];
$modcount = new Modcount(sizeof($cols));

foreach($users as $user) {
    echo '';

    foreach($user as $datum) {
         echo sprintf('%s',
            $cols[$modcount()],
            $datum);
    }

    echo '';
}

```

This is a poor example because using the loop index of that inner `foreach` loop would do the same thing, but more complicated situations can arise making this object handy.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

2352d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.1PHP 7.3.\*

1.0.3PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8269?v=4)[David Dashifen Kees](/maintainers/dashifen)[@dashifen](https://github.com/dashifen)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/dashifen-modcount/health.svg)

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

###  Alternatives

[symfony/polyfill-php84

Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions

13274.8M132](/packages/symfony-polyfill-php84)[odolbeau/phone-number-bundle

Integrates libphonenumber into your Symfony application

24910.3M11](/packages/odolbeau-phone-number-bundle)[jwadhams/json-logic-php

Build rules with complex comparisons and boolean operators, serialized as JSON, and execute them in PHP

1641.7M6](/packages/jwadhams-json-logic-php)[zumba/swivel

Strategy driven feature toggles

209135.7k5](/packages/zumba-swivel)[konnco/filament-safely-delete

343.0k](/packages/konnco-filament-safely-delete)

PHPackages © 2026

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