cognesy / instructor-pipeline
Pipeline processing functionality for Instructor PHP library
v2.9.5
2026-08-30 01:03 UTC
Requires
- php: ^8.3
- cognesy/instructor-utils: ^2.9
- psr/event-dispatcher: ^1.0
Requires (Dev)
- icanhazstring/composer-unused: ^0.9.0
- jetbrains/phpstorm-attributes: ^1.2
- maglnet/composer-require-checker: ^4.16
- pestphp/pest: ^4.0
- phpbench/phpbench: ^1.4
- phpstan/phpstan: ^1.11
- roave/security-advisories: dev-latest
- vimeo/psalm: ^6.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v2.9.5
- v2.9.4
- v2.9.3
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.5
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.1
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.22.0
- v1.21.0
- v1.20.0
- v1.19.0
- v1.18.4
- v1.18.3
- v1.18.2
- v1.18.1
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
This package is auto-updated.
Last update: 2026-08-30 02:04:57 UTC
README
Small immutable pipelines for value transformations with Result-backed state.
What It Is
The package now exposes one pipeline implementation:
- value-oriented steps via
through()andthroughAll() - side effects via
tap()andonFailure() - final shaping via
finally() - lazy execution via
PendingExecution - immutable state via
ProcessingState - post-processing helpers via
TransformState
Basic Usage
use Cognesy\Pipeline\Pipeline; use Cognesy\Pipeline\ProcessingState; $result = Pipeline::builder() ->through(fn(string $value) => trim($value)) ->through(fn(string $value) => strtoupper($value)) ->create() ->executeWith(ProcessingState::with(' hello ')) ->value();
Failure Handling
use Cognesy\Pipeline\StateContracts\CanCarryState; use Cognesy\Utils\Result\Result; $result = Pipeline::builder() ->through(fn() => throw new RuntimeException('broken')) ->onFailure(fn(CanCarryState $state) => report($state->exception())) ->finally(fn(CanCarryState $state) => match ($state->isSuccess()) { true => $state->result(), false => Result::failure('pipeline failed'), }) ->create() ->executeWith(ProcessingState::with('input')) ->result();
State Helpers
ProcessingState stores:
- a
Result - ordered tags
TransformState is a small helper for mapping, recovery, and tag-preserving state transformations after pipeline execution.