PHPackages                             enzyme/loopy - 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. enzyme/loopy

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

enzyme/loopy
============

A loop library for PHP.

v1.0.0(10y ago)119MITPHPPHP &gt;=5.5.0

Since Dec 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/enzyme/loopy)[ Packagist](https://packagist.org/packages/enzyme/loopy)[ Docs](https://github.com/enzyme/loopy)[ RSS](/packages/enzyme-loopy/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (7)Used By (0)

[![](https://cloud.githubusercontent.com/assets/2805249/11684981/4d6de34c-9ec1-11e5-97a1-2aee3eb0ab3b.png)](https://cloud.githubusercontent.com/assets/2805249/11684981/4d6de34c-9ec1-11e5-97a1-2aee3eb0ab3b.png)

[![Build Status](https://camo.githubusercontent.com/1287ce1b65e79c3b5849b299a9b31310c90963cb6246561c499530891cd82282/68747470733a2f2f7472617669732d63692e6f72672f656e7a796d652f6c6f6f70792e737667)](https://travis-ci.org/enzyme/loopy)[![Coverage Status](https://camo.githubusercontent.com/5a1f16ee717f730ce80017cb5c07877a0d4f8633f0a689049e691897894dc0b1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f656e7a796d652f6c6f6f70792f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/enzyme/loopy?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7df2db3a71122e196b791c33ffda04208ef1662b25b3049f707eba8edbbe96c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656e7a796d652f6c6f6f70792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/enzyme/loopy/?branch=master)

A loop library for PHP.

Installation
============

[](#installation)

Run the following command inside of your project directory.

```
composer require enzyme/loopy
```

Usage
=====

[](#usage)

#### Simple

[](#simple)

A simple loop over an array.

```
use Enzyme\Loopy\Each;

$array = [1, 2, 3];

Each::shallow()->begin($array, function($bag) {
    echo $bag->value() . ', ';
});
```

The above will output `1, 2, 3, `

#### Deep

[](#deep)

A deep loop over a multidimensional array.

```
use Enzyme\Loopy\Each;

$array = [1, 2, 3, 4 => [4, 5, 6]];

Each::deep()->begin($array, function($bag) {
    echo $bag->value() . ', ';
});
```

The above will output `1, 2, 3, 4, 5, 6, `

#### Filtered

[](#filtered)

A loop over a filtered array.

```
use Enzyme\Loopy\Each;
use Enzyme\Loopy\Filters\SkipNulls;

$array = [1, 2, null, 4, 5];

Each::deep(new SkipNulls)->begin($array, function($bag) {
    echo $bag->value() . ', ';
});
```

The above will output `1, 2, 4, 5, `

Bags
====

[](#bags)

The `$bag` object passed to the callback function generally contains the follow information.

KeyValueDescriptionkey()KeyThe enumerable objects key for the given pass.value()ValueThe enumerable objects value for the given pass.cycle()Current cycle (0 based)How many times around the entire object the looper has gone.depth()Current depth (0 based)The current depth of the pass, for multidimensional arrays.index()Current index (0 based)The current index, in this case index is really a count of the number of items encountered so far.Filters
=======

[](#filters)

FilterDescriptionSkipNullsWill skip over any values which are null.RegexWill test value against the supplied regular expression.EqualWill test value for equality against the given rule. (===)LessWill test that value is less than the give rule, or less than or equal if parameter 2 in the constructor is set to true.GreaterWill test that value is greater than the give rule, or greater than or equal if parameter 2 in the constructor is set to true.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

3734d ago

Major Versions

v0.0.4 → v1.0.02016-04-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/148afe40f056b8f57e43ed0505c6040f762e26805b1d1bebed87484d529bae07?d=identicon)[r3oath](/maintainers/r3oath)

---

Top Contributors

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

---

Tags

phploopforeachforwhileenzyme

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/enzyme-loopy/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21422.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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