Documentation Index
Fetch the complete documentation index at: https://docs.instructorphp.com/llms.txt
Use this file to discover all available pages before exploring further.
Release Notes
Executive Summary
This release represents a major architectural milestone for the instructor-php monorepo, introducing the new stream package for functional data processing and significantly refactoring the instructor package’s streaming architecture. The changes focus on modularity, composability, and maintainability while improving type safety across all packages.- New
streampackage: Complete functional stream processing library with 24+ sources, 40+ transducers, and 20+ reducers - Major instructor refactoring: Streaming architecture completely redesigned for modularity and testability
- Better code organization: Logical namespace restructuring across multiple packages
- Enhanced utilities: New data structures (Deque, Buffer, RingBuffer) and error collection system
- Type safety improvements: Better PHPDoc annotations and flexible type hints
instructor Package
- Replaced
PartialsGeneratorwith modular components:- Use
GeneratePartialsFromJsonfor JSON streaming mode - Use
GeneratePartialsFromToolCallsfor tool-based streaming mode
- Use
- Method rename:
CanGeneratePartials::getPartialResponses()→makePartialResponses() - Moved classes to new namespaces (aliases may be provided for backward compatibility):
Core/ResponseModelFactory→Creation/ResponseModelFactoryCore/StructuredOutput*→Creation/StructuredOutput*Core/SequenceableHandler→Streaming/SequenceGen/SequenceableEmitter
stream Package
A complete functional stream processing library implementing transducers:
- 24+ Stream Sources: Array, CSV, JSON, JSONL, HTTP, Filesystem, Text processing
- 40+ Transducers: Transform, filter, flatten, group, limit, combine, deduplicate
- 20+ Reducers: Terminal operations for stats, selection, side effects
- Tee Splitting: Process same source through multiple parallel pipelines
- Result Monad Support: Functional error handling with dedicated transducers/reducers
- Progressive Rendering: Iterator-based execution for memory-efficient streaming
utils Package
- Deque and Circular Buffer data structures
- Immutable error collection system with serialization
- New Arrays operations for merging multiple arrays
polyglot Package
Inference/Creation/: Factory and builder classesInference/Streaming/: Stream processing with newContentAccumulationclass- Optimized
InferenceExecution::errors()usingArrays::mergeMany() - Refactored
InferenceStream::makePartialResponses()with extracted methods
http-client Package
- Simplified Symfony driver
- Added annotations to streaming methods
addons Package
Type Flexibility:
- Relaxed
StepByStepreturn types fromGenerator<mixed, TState, mixed, mixed>toiterable<TState> - Allows implementations to return any iterable type while maintaining type safety