Download the PHP package burnett01/php-piper without Composer
On this page you can find all versions of the php package burnett01/php-piper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download burnett01/php-piper
More information about burnett01/php-piper
Files in burnett01/php-piper
Package php-piper
Short Description Piper enhances the PHP 8.5 pipe operator (|>) with support for multi-argument functions/callables.
License MIT
Informations about the package php-piper
Piper
Piper enhances the PHP 8.5 pipe operator (|>) with support for multi-argument functions/callables.
Background
In PHP the pipe operator (|>) works with single-argument callables, such as strlen, trim, etc..,
but what if you want to use it with multi-argument callables, such as rtrim, strtr, etc..
This is where Piper comes into play!
How it works
Piper is sort of a decorator/wrapper around a callable for the pipe operator |>.
Usage
composer require burnett01/php-piper
PSR-4 function version:
PSR-4 class version:
The ellipsis ... represents the first-class callable syntax.
You can use a callable as string or first-class syntax for passing the method.
Other examples
Api
-
Piper::to(callable $fn, mixed ...$args)Creates an instance of Piper for the specificed
$fn.Parameters:
-
callable
$fn- The name of a callable as string (eg.'strlen') or as first-class syntax (eg.strlen(...)) - variadic (mixed)
$args- The arguments for$fn
Context: static
Returns: instance
-
-
Piper::with(callable $fn, mixed ...$args)alias for
Piper::to(callable $fn, mixed ...$args)(see above) -
pipe(callable $fn, mixed ...$args)alias for
Piper::to(callable $fn, mixed ...$args)(see above) -
with(callable $fn, mixed ...$args)alias for
Piper::to(callable $fn, mixed ...$args)(see above)