compose when you want a reusable Closure.
Immediately threads a value through a sequence of callables left-to-right and returns the final result. The imperative cousin of compose().
/**
* @param mixed $value
* @param callable(mixed):mixed ...$callables
* @return mixed
*/
GeneralFunctions\pipe($value, callable ...$callables)This can be used to create a simple closure which can be used as a regular function.
$slug = GeneralFunctions\pipe(
' Hello World ',
'trim',
'strtolower',
Strings\replaceWith(' ', '-')
);
echo $slug; // 'hello-world'