You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pipeline operations are functions that take an input and return a processed value. Each operation can receive up to three parameters:
63
+
Pipeline operations are functions that take an input and return a processed value. Each operation can receive up to four parameters:
62
64
-`$input`: The value being processed
63
65
-`$next`: A callback to pass the value to the next operation
64
66
-`$return`: (Optional) A callback to exit the pipeline early with a value
67
+
-`$context`: (Optional) A shared context object passed to all operations
65
68
66
69
#### Basic Operation Example
67
70
Let's build an input sanitization pipeline:
@@ -157,6 +160,77 @@ $pipeline = zenpipe()
157
160
]);
158
161
```
159
162
163
+
### Context Passing
164
+
165
+
You can pass a shared context object to all operations using `withContext()`. This is useful for sharing state, configuration, or dependencies across the pipeline without threading them through the value.
166
+
167
+
```php
168
+
// Use any object as context - your own DTO, stdClass, or array
0 commit comments