middlewareCallable.php
Table of Contents
Functions
- middlewareCallable() : callable
- Wrap a callable with before/after middleware.
Functions
middlewareCallable()
Wrap a callable with before/after middleware.
middlewareCallable(callable $callable[, callable|array<string|int, callable> $before = [] ][, callable|array<string|int, callable> $after = [] ]) : callable
This function allows decorating a callable with logic that runs
before and/or after the original callable. Supports a single callable
or an array of callables for both before and after.
beforecallables receive the original arguments.aftercallables receive the original arguments + the result. If an after callback returns a non-null value, it overrides the result.
Parameters
- $callable : callable
-
The main callable to wrap
- $before : callable|array<string|int, callable> = []
-
Callable or array of callables to run before
- $after : callable|array<string|int, callable> = []
-
Callable or array of callables to run after
Tags
Return values
callable —Wrapped callable with middleware applied