PHPackages                             antevenio/stream-regex-iterator - 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. antevenio/stream-regex-iterator

ActiveLibrary

antevenio/stream-regex-iterator
===============================

PHP iterator of regex matches over streams

0.0.4(7y ago)114.5k↓25%MITPHPPHP &gt;=5.6

Since May 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/pinfake/stream-regex-iterator)[ Packagist](https://packagist.org/packages/antevenio/stream-regex-iterator)[ Docs](https://github.com/pinfake/stream-regex-iterator)[ RSS](/packages/antevenio-stream-regex-iterator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

stream-regex-iterator
=====================

[](#stream-regex-iterator)

Find regular expresion matches on seekable text streams and return them inside an iterator.

Description
-----------

[](#description)

This iterator comes as a solution to having to run complex multi line regular expressions on big files without exhausting memory.

The iterator will read chunks of data from the stream and run `preg_match_all()`on each one of them.

The iterator will read chunks of data in a way that it ensures no possible matches are lost through chunks, i.e. possible matches existing amidst chunk split points.

The iterator will return matches as `preg_match_all()` would do when using the `PREG_SET_ORDER | PREG_OFFSET_CAPTURE` flags.

Limitations
-----------

[](#limitations)

The specified stream must be fully seekable (back and forward).

The specified buffer size must be able to store the longest possible full match of the regexp.

The iterator will require approximately twice the specified buffer size memory.

Requirements
------------

[](#requirements)

The following versions of PHP are supported.

- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3

Installation:
-------------

[](#installation)

```
composer require antevenio/stream-regex-iterator

```

Usage
-----

[](#usage)

```
$inputString = "line1\nline2\nline3\nline4\nline5\nstart\nline6\nline7\nend";

$stream = fopen("data://text/plain," . $inputString, "r");

$matches = new Antevenio\StreamRegexIterator\Iterator(
    "/^start.*?end$/sm",
    $stream,
    32
);

foreach ($matches as $match) {
    print_r($match);
}
```

Would output:

```
Array
(
    [0] => Array
        (
            [0] => start
line6
line7
end
            [1] => 30
        )

)

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

2

Last Release

2559d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3945156?v=4)[Iván Mota](/maintainers/pinfake)[@pinfake](https://github.com/pinfake)

---

Top Contributors

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

---

Tags

bigexpressionfileiteratormemoryphpregularsafestreamstreamiteratorregexregular expression

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antevenio-stream-regex-iterator/health.svg)

```
[![Health](https://phpackages.com/badges/antevenio-stream-regex-iterator/health.svg)](https://phpackages.com/packages/antevenio-stream-regex-iterator)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.0B3.2k](/packages/guzzlehttp-psr7)[composer/pcre

PCRE wrapping library that offers type-safe preg\_\* replacements.

699313.8M34](/packages/composer-pcre)[ezimuel/guzzlestreams

Fork of guzzle/streams (abandoned) to be used with elasticsearch-php

176108.6M3](/packages/ezimuel-guzzlestreams)[niklongstone/regex-reverse

Regular Expression reverter, generates a string from a provided regular expression

105150.4k4](/packages/niklongstone-regex-reverse)[markrogoyski/itertools-php

Iteration tools for PHP

14911.3k](/packages/markrogoyski-itertools-php)[lucleroy/php-regex

PHP Regular Expressions Builder

474.7k3](/packages/lucleroy-php-regex)

PHPackages © 2026

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