TheWebSolver Pipeline library follows the 🔗 Chain of Responsibility Design Pattern 🔗 to handle the given subject/request using pipes. The pipeline can accept any subject type, passes it through provided pipes and return the updated subject back.
Install library using composer command:
$ composer require thewebsolver/pipeline
-
Follows Chain of Responsibility design pattern by passing subject to pipeline handlers in order they were stacked.
Use
Pipeline::through()
method to pass main handlers as pipe. Optionally, pass additional handlers usingPipeline::pipe()
method. -
Provides support for additional arguments that can be accepted by each handler passed using above methods.
Use
Pipeline::use()
method to pass as many arguments as required. -
Provides support for catching Pipe Exception or Unexpected Exception thrown by the handler.
Use
Pipeline::sealWith()
method to pass a closure to handle thrown exception. -
Provides bridge for PHP Projects that implements PSR-7, PSR-15 (optional PSR-11) standards.
Use Queue based Request Handler implementation to handle stacked middlewares inside Request Handler's handle method (
RequestHandlerInterface::handle()
).
For usage details, visit Wiki page.