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

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

cupoftea/counter
================

Simple indexed looping

v1.1.0(9y ago)02271MITPHP

Since Jan 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/CupOfTea696/Counter)[ Packagist](https://packagist.org/packages/cupoftea/counter)[ RSS](/packages/cupoftea-counter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/5799e484c45a0c0aca4b503536fbb774a3bc0423ea279133236e2333f76cbda6/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f636f756e7465722f76657273696f6e2e737667)](https://packagist.org/packages/cupoftea/counter) [![Total Downloads](https://camo.githubusercontent.com/27a1eb098fa2eed94d85c6d67b1a473a4756778ca7ae8a822d13b30706436d07/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f636f756e7465722f642f746f74616c2e737667)](https://packagist.org/packages/cupoftea/counter) [![Latest Unstable Version](https://camo.githubusercontent.com/f07d1e9b45e1f89a85567c020268c67b847a72dc0d4b562d6739f6262371c076/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f636f756e7465722f762f756e737461626c652e737667)](https://packagist.org/packages/cupoftea/counter)[![StyleCI](https://camo.githubusercontent.com/ac5365fd650edc3a8cfd4420350a80b11d445505e2ea8210e632e98143aa5efa/68747470733a2f2f7374796c6563692e696f2f7265706f732f35303336333132392f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/50363129)[![License](https://camo.githubusercontent.com/d545a40506d282ee8f498660b79407ee18e2246e044a034d4b5f58f4da8454b7/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f636f756e7465722f6c6963656e73652e737667)](https://packagist.org/packages/cupoftea/counter)

Counter
=======

[](#counter)

### Simple indexed looping.

[](#simple-indexed-looping)

Easily loop over any Traversable or Array while keeping track of the index. It will also accept any other variable types, and cast those to an array.

With Counter you can both keep track of the current index and iteration while traversing any variable, regardless of which keys are being used. In addition to that, Counter also provides a stack of useful methods to check if the current iteration matches set requirements, for example `Counter::first()` and `Counter::even()`.

- [Documentation](http://counter.cupoftea.io/docs/)
- [API Reference](http://counter.cupoftea.io/docs/api/)

Quickstart
----------

[](#quickstart)

```
$ composer require cupoftea/counter ^1.0
```

### Laravel integration

[](#laravel-integration)

Add the Counter ServiceProvider to your `config/app.php`.

```
	'providers' => [

		/*
		 * Laravel Framework Service Providers...
		 */

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Bus\BusServiceProvider',

        ...

        'CupOfTea\Counter\CounterServiceProvider',

	],
```

Optionally you can also add the Counter Facade if you wish to use it.

```
    'aliases' => [

		'App'       => 'Illuminate\Support\Facades\App',
		'Artisan'   => 'Illuminate\Support\Facades\Artisan',
		'Auth'      => 'Illuminate\Support\Facades\Auth',

		...

        'Counter' => 'CupOfTea\Counter\Facades\Counter',

	],
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

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

Total

5

Last Release

3529d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2977bc0c1a9c62466102bce06ba22bca2897d5a0176087f2c6d8924e55f60c42?d=identicon)[CupOfTea696](/maintainers/CupOfTea696)

---

Top Contributors

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

---

Tags

composer-packagescounteriterationlaravellaravel-5-packagelaravel-packageloopingphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bitbag/dhl24-pl-shipping-export-plugin

DHL24 PL shipping export plugin for Sylius based applications.

101.9k](/packages/bitbag-dhl24-pl-shipping-export-plugin)

PHPackages © 2026

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