Releases: TheWebSolver/pipeline
PSR-7, PSR-11, & PSR-15 Integration | Updated Namespace
v2 is a complete rewrite and has breaking changes when compared to v1.
- Streamlined namespace: TheWebSolver\Codegarage\Pipeline
- PSR-7, PSR-15 & Bridge files moved to separate directory: Server
- Converted
PipelineBridge
class to a facade for type-safety/security & better DX: TheWebSolver\Codegarage\Pipeline\Bridge - Dependency & auto-wiring support: PSR-11: Container interface
- Dropped Middleware Adapter support. Only supports Middleware that implements: PSR-15: HTTP Server Request Handlers
Streamlined exceptions thrown
Feature:
- InvalidPipeline exception now has two new methods:
InvalidPipeline::getSubject()
-> Gets the subject that was being processed by the pipe throwing the exception. Thus, it will return the immediate previous version of the subject.InvalidPipeline::hasSubject()
-> Determines whether subject has been added to exception or not.
Enhancement:
- Streamlined exceptions thrown by the Pipeline. It can now either be:
- InvalidPipe -> Application level error where given Pipe is not a valid Pipe variant, or
- InvalidPipeline -> Any other variant will be transformed to this exception.
- When exception catching function/closure is provided to
Pipeline::sealWith()
method, it will not catchInvalidPipe
exception anymore. This is an application level error and MUST BE FIXED. - App Container no longer verifies before resolving the classname. It is suitable in situation where the given classname has no dependencies and no Auto-Wiring is necessary.
Internal Request Handler Adapter. Exception breaking change.
💥 Breaking Change:
- Renamed Exception class names.
🎯 Core Updates:
- Reduced: doc comments.
- Added: PHPCS whitelisting (not published in project though).
- Updated: constant name
CODEGARAGE_PSR_PACKAGE_INSTALLED
toTWS_CODEGARAGE_PSR_PACKAGE_INSTALLED
for create-wordpress-project compatibility.
🚧 PSR-15 Bridge Updates:
- Added: New Internal Request Handler as well as option to bring your own Internal Request Handler Adapter that returns the response generated by pipe handler. The Adapter can be used in the pipeline like so:
$pipeline->use($request, RequestHandlerAdapter::class)
.
This
RequestHandlerAdapter
accepts the pipe response via its constructor.
- Removed: passing Response as Request Attribute and implemented double-pass approach with new Internal Request Handler.
New Exception Classes & Tests
- Added Pipeline-specific Exception Classes
- Added Test Bootstrap file and additional tests
Removed Composer version.
Composer to infer version from GitHub releases.
NEW: Support for PSR-15 Middleware Adapter & PSR-11 Container
-
The Pipeline bridge now supports external Adapters to create Pipes from those Middleware adapters.
PipelineBridge::setMiddlewareAdapter()
accepts both inertface name as well as classname to convert middleware to pipe.PipelineBridge::resetMiddlewareAdapter()
in case the above task was one-off task. -
It also supports PSR-11
\Psr\Container\ContainerInterface
to manage all your project dependencies at one place.Use
PipelineBridge::setApp()
to pass app container. -
Moved repository documentation to the GitHub Wiki page.
Support for PSR-7 and PSR-15
PipelineBridge for seamless handling of Middlewares and storing each middleware response.