henzeb / laravel-pipeline-factory
Compose complex pipelines
Requires
- php: ^8.1
- henzeb/closure: ^1.7.0
- illuminate/support: ^10|^11
Requires (Dev)
- nesbot/carbon: v2.72.2
- orchestra/testbench: ^8.0|^9.0
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.6.6|^10
README
Laravel has a convenient Pipeline to be used to separate the logic in a way that allows modifying an object and allows for easy interchangeable components.
Laravel Pipeline Factory takes it a step further and gives you a couple of 'pipes' to help you build a more complex pipeline.
Example
use Illuminate\Support\Facades\Pipeline; use Henzeb\Pipeline\Facades\Pipe; use App\Models\User; $user = User::find(1); Pipeline::send($user) ->through( Pipe::events( Pipe::unless( UserEnteredPasswordTwice::class, ReturnInvalidRequestResponse::class )->else( Pipe::rescue( Pipe::transaction( [ UpdateUser::class, UpdateAddress::class ] ), ReturnFailureResponse::class, ) ), 'updateUserDetails' ) )
Installation
Just install with the following command.
composer require henzeb/laravel-pipeline-factory
usage
Every pipe included in this package is invokable. This means you
don't have to stick with handle
as it's via
method.
The following pipes are available:
- The Adapter Pipe
- The Conditional Pipe
- The Contextless Pipe
- The Definition Pipe
- The Each Pipe
- The Events Pipe
- The Job Pipe
- The Queue Pipe
- The Rescue Pipe
- The Resolving Pipe
- The Throw Pipe
- The Transaction Pipe
- The While / Until Pipe
Testing this package
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email henzeberkheij@gmail.com instead of using the issue tracker.
Credits
License
The GNU AGPLv. Please see License File for more information.