PHPackages                             dromru/iterable-chunk - 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. dromru/iterable-chunk

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

dromru/iterable-chunk
=====================

Класс для разбиения итерируемых коллекций на пачки.

v2.0.0(3y ago)511.6k↓33.3%MITPHPPHP &gt;=7.4

Since Mar 15Pushed 3y ago4 watchersCompare

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

READMEChangelogDependencies (11)Versions (7)Used By (0)

iterable-chunk
==============

[](#iterable-chunk)

[![Latest Stable Version](https://camo.githubusercontent.com/02132d02d588c2fc3787478913c906a5377b640b18b1e68bdc2fdffec734717b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64726f6d72752f6974657261626c652d6368756e6b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dromru/iterable-chunk)[![Tests](https://github.com/dromru/iterable-chunk/workflows/Tests/badge.svg)](https://github.com/dromru/iterable-chunk/actions)[![Coverage Status](https://camo.githubusercontent.com/da80670edd91ff98e26c3e9f30ce3911b9544d5f5b010100da83d8b000d62db0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64726f6d72752f6974657261626c652d6368756e6b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/dromru/iterable-chunk?branch=master)[![Minimum PHP Version](https://camo.githubusercontent.com/eb773fa94283cbea6c7b192d460983a781ae4a16409af56d109fe3e8e71ab6c9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)

Проблема
--------

[](#проблема)

Нативная [array\_chunk](https://www.php.net/manual/ru/function.array-chunk.php) не поддерживает `iterable`. Реализация [ChunkedIterator](https://github.com/guzzle/guzzle3/blob/master/src/Guzzle/Iterator/ChunkedIterator.php)от Guzzle уступает по скорости обхода данной реализации.

Решение
-------

[](#решение)

`iterable-chunk` - пакет, который предоставляет класс для разбиения итерируемых коллекций `iterable` на пачки.

P.S. Реализован с использованием генераторов, поэтому до 8 раз быстрее [ChunkedIterator](https://github.com/guzzle/guzzle3/blob/master/src/Guzzle/Iterator/ChunkedIterator.php).

Benchmark
---------

[](#benchmark)

[![](./assets/bench.png)](./assets/bench.png)

Пример использования
--------------------

[](#пример-использования)

```
function getIterable(): iterable
{
    yield from [1, 2, 3, 4, 5];
}

$chunks = new IterableChunk(getIterable(), 2, true);

foreach ($chunks as $chunk) {
    print_r($chunk);
}
```

```
[0 => 1, 1 => 2]
[2 => 3, 3 => 4]
[4 => 5]

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

Every ~62 days

Recently: every ~70 days

Total

6

Last Release

1212d ago

Major Versions

v1.0.4 → v2.0.02023-01-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/7829b5718494f0f56b33328e6d289a7b52c4acf0fe572498bcbad47728a774b7?d=identicon)[los-romka](/maintainers/los-romka)

---

Top Contributors

[![los-romka](https://avatars.githubusercontent.com/u/1947036?v=4)](https://github.com/los-romka "los-romka (2 commits)")

---

Tags

phpchunkiterable

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dromru-iterable-chunk/health.svg)

```
[![Health](https://phpackages.com/badges/dromru-iterable-chunk/health.svg)](https://phpackages.com/packages/dromru-iterable-chunk)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

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

PHPackages © 2026

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