PHPackages                             quorum/stream-functions - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. quorum/stream-functions

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

quorum/stream-functions
=======================

useful php-stream resource handling functions for common lexing and parsing tasks

v0.1.0(2y ago)131.6k↓18.8%[1 PRs](https://github.com/QuorumCollection/StreamFunctions/pulls)MITPHPPHP ^7.2|^8.0CI passing

Since Oct 31Pushed 2w ago2 watchersCompare

[ Source](https://github.com/QuorumCollection/StreamFunctions)[ Packagist](https://packagist.org/packages/quorum/stream-functions)[ RSS](/packages/quorum-stream-functions/feed)WikiDiscussions master Synced yesterday

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

Quorum Stream Functions
=======================

[](#quorum-stream-functions)

[![Latest Stable Version](https://camo.githubusercontent.com/23960005149480dfb52b2934b29e41fd1716b6c5be382754ee9f9d942f571056/68747470733a2f2f706f7365722e707567782e6f72672f71756f72756d2f73747265616d2d66756e6374696f6e732f76657273696f6e)](https://packagist.org/packages/quorum/stream-functions)[![License](https://camo.githubusercontent.com/29a84b2a6c4fa25e7d244c248bd26880be9e9dd05e727e9131e357d5d5b88ed4/68747470733a2f2f706f7365722e707567782e6f72672f71756f72756d2f73747265616d2d66756e6374696f6e732f6c6963656e7365)](https://packagist.org/packages/quorum/stream-functions)[![ci.yml](https://github.com/QuorumCollection/StreamFunctions/actions/workflows/ci.yml/badge.svg?)](https://github.com/QuorumCollection/StreamFunctions/actions/workflows/ci.yml)

Useful functions for manipulating PHP streams (resources).

The general structure of these are inspired by a [talk given by Rob Pike](https://www.youtube.com/watch?v=HxaD_trXwRE).

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

[](#requirements)

- **php**: ^7.2|^8.0

Installing
----------

[](#installing)

Install the latest version with:

```
composer require 'quorum/stream-functions'
```

Stream Functions
----------------

[](#stream-functions)

### Function: \\Quorum\\Streams\\faccept

[](#function-quorumstreamsfaccept)

```
function faccept($stream, string ...$accept) : ?string
```

##### Parameters:

[](#parameters)

- ***resource*** `$stream` - The stream to peek, must be a seekable resource
- ***string*** `$accept` - One or more strings to accept

##### Returns:

[](#returns)

- ***string*** | ***null*** - The accepted string or null if none were found

faccept peeks the given stream for the given string returning it if it is
found \* or null if it is not.

If the string is found, the cursor remains advanced to the end of the string.
If the string is not found, the cursor is reset to its original position.

### Function: \\Quorum\\Streams\\fpeek

[](#function-quorumstreamsfpeek)

```
function fpeek($stream [, int $length = 1]) : string
```

##### Parameters:

[](#parameters-1)

- ***resource*** `$stream` - The stream to peek, must be a seekable resource
- ***int*** `$length` - Up to length number of bytes read.

##### Returns:

[](#returns-1)

- ***string*** - The peeked string of up to length bytes

fpeek peeks the given stream for the given length returning as found.

The cursor is reset to its original position.

### Function: \\Quorum\\Streams\\funtil

[](#function-quorumstreamsfuntil)

```
function funtil($stream, string $until [, int $length = 0 [, ?string $buf = null]]) : bool
```

##### Parameters:

[](#parameters-2)

- ***resource*** `$stream` - The stream to read, must be a seekable resource
- ***string*** `$until` - The string to read until
- ***int*** `$length` - The maximum number of bytes to read, defaults to 0 (no limit)
- ***string*** | ***null*** `$buf` - The buffered contents by reference

##### Returns:

[](#returns-2)

- ***bool***

funtil reads the given stream until the given string is found or eof is reached

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance64

Regular maintenance activity

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81% 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

Unknown

Total

1

Last Release

975d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a57a02ba022451a54d4b65e227ce3d032cadc638a644c2d4b56f0313632ee656?d=identicon)[donatj](/maintainers/donatj)

---

Top Contributors

[![donatj](https://avatars.githubusercontent.com/u/133747?v=4)](https://github.com/donatj "donatj (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

streamparsinglexing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/quorum-stream-functions/health.svg)

```
[![Health](https://phpackages.com/badges/quorum-stream-functions/health.svg)](https://phpackages.com/packages/quorum-stream-functions)
```

###  Alternatives

[jakubledl/dissect

Lexing and parsing in pure PHP

2234.7M11](/packages/jakubledl-dissect)[parsica-php/parsica

The easiest way to build robust parsers in PHP.

412183.1k4](/packages/parsica-php-parsica)[kingsquare/php-mt940

Simple MT940 parser in PHP

107838.9k3](/packages/kingsquare-php-mt940)[jejik/mt940

An MT940 bank statement parser for PHP

881.2M2](/packages/jejik-mt940)[denissimon/formula-parser

Parsing and evaluating mathematical formulas given as strings.

81337.8k3](/packages/denissimon-formula-parser)[codelicious/php-coda-parser

PHP parser for Belgian CODA banking files

45400.6k2](/packages/codelicious-php-coda-parser)

PHPackages © 2026

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