cognesy / instructor-stream
Stream processing utilities
v2.0.0
2026-03-13 19:48 UTC
Requires
- php: ^8.3
- cognesy/instructor-utils: ^2.0
Requires (Dev)
- icanhazstring/composer-unused: ^0.9.0
- jetbrains/phpstorm-attributes: ^1.2
- maglnet/composer-require-checker: ^4.16
- pestphp/pest: ^2.34
- phpstan/phpstan: ^1.11
- roave/security-advisories: dev-latest
- vimeo/psalm: ^6.0
README
Low-level stream processing utilities for InstructorPHP, built around transducers.
Use it to compose reusable transformations and run them over arrays, files, text, CSV/JSONL, HTTP chunk streams, or custom iterables.
Example
<?php use Cognesy\Stream\Transformation; use Cognesy\Stream\Transform\Filter\Transducers\Filter; use Cognesy\Stream\Transform\Limit\Transducers\TakeN; use Cognesy\Stream\Transform\Map\Transducers\Map; $result = Transformation::define( new Map(fn($x) => $x * 2), new Filter(fn($x) => $x > 5), new TakeN(3), )->executeOn([1, 2, 3, 4, 5, 6]);
Documentation
packages/stream/CHEATSHEET.mdpackages/stream/INTERNALS.mdpackages/stream/tests/