PHPackages                             hunts/stream.php - 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. hunts/stream.php

ActiveLibrary

hunts/stream.php
================

PHP implementation of collection query API similar to Java Stream API and .NET Linq

v0.1.0(6y ago)17[1 issues](https://github.com/hunts/stream.php/issues)[1 PRs](https://github.com/hunts/stream.php/pulls)MITPHPPHP &gt;=7.2.0CI failing

Since Feb 24Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/hunts/stream.php)[ Packagist](https://packagist.org/packages/hunts/stream.php)[ RSS](/packages/hunts-streamphp/feed)WikiDiscussions master Synced 2d ago

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

Stream.php
==========

[](#streamphp)

[![build status](https://camo.githubusercontent.com/8a2bf000bd63425f293b5bab2c40635e011b023ca57bd5372afca373c435bb7e/68747470733a2f2f6170692e7472617669732d63692e6f72672f68756e74732f73747265616d2e7068702e737667)](https://travis-ci.org/hunts/stream.php)[![Coverage Status](https://camo.githubusercontent.com/b1659b15972dbb98ab7e6b2a172bcbe8e4c1c931999ed9b1dbe1dde0cab1be94/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f68756e74732f73747265616d2e7068702f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/hunts/stream.php?branch=master)

The stream.php library is a PHP implementation of collection query API similar to Java Stream API and .NET Linq.

Table of Contents
=================

[](#table-of-contents)

---

1. [Installation](#Installation)
    - [Composer](#composer)
2. [Classes and methods](#classes-and-methods)
    - [Usage](#usage)
    - [Query API](#query-api)

---

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

[](#installation)

Composer
--------

[](#composer)

```
composer require hunts/stream.php
```

Classes and methods
===================

[](#classes-and-methods)

Usage
-----

[](#usage)

1. [Class Stream](#class-stream)
2. [Class NumberStream](#class-numberstream)
3. [Global Functions](#global-functions)

### Class Stream

[](#class-stream)

***Description***: Instantiate a new Stream object

##### *Example*

[](#example)

```
use Hunts\Stream;
...
$stream = Stream::from([$user1, $user2, $user3]);
```

### Class NumberStream

[](#class-numberstream)

***Description***: Instantiate a new NumberStream object

##### *Example*

[](#example-1)

```
use Hunts\Stream;
...
$stream = NumberStream::from([1, 2, 3]);
```

### Global functions

[](#global-functions)

***Description***: Instantiate a new Stream object via global function: stream() or number\_stream()

##### *Example*

[](#example-2)

```
$stream = stream([$user1, $user2, $user3]);
$stream = number_stream([1, 2, 3]);
```

Query API
---------

[](#query-api)

- [Filter](API.md#filter) - Filter elements that match the give predicate
- [First](API.md#first) - Return the first element of matched items
- [Last](API.md#last) - Return the last element of matched items
- [Max](API.md#max)
- [Min](API.md#min)
- [Any](API.md#any)
- [All](API.md#all)
- [Each](API.md#each)
- [Map](API.md#map)
- [MapToNumber](API.md#maptonumber)
- [Reduce](API.md#reduce)
- [Distinct](API.md#distinct)
- [Sort](API.md#sort)
- [SortByDescending](API.md#sortbydescending)
- [Skip](API.md#skip)
- [Limit](API.md#limit)
- [Count](API.md#count)
- [ToArray](API.md#toarray)

###  Health Score

24

↓

LowBetter than 32% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

2271d ago

### Community

Maintainers

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

---

Top Contributors

[![hunts](https://avatars.githubusercontent.com/u/211390?v=4)](https://github.com/hunts "hunts (20 commits)")

---

Tags

phplinqStream APIstream.php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hunts-streamphp/health.svg)

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

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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