Skip to content

Pipeline used in various TheWebSolver packages. Acts as bridge for PSR-15 implementation's Request Handler to handle middlewares flawlessly.

License

Notifications You must be signed in to change notification settings

TheWebSolver/pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome

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.

Installation (via Composer)

Install library using composer command:

$ composer require thewebsolver/pipeline

Benefits

  • 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 using Pipeline::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()).

Usage

For usage details, visit Wiki page.