承接 componenta/pipeline 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componenta/pipeline

Composer 安装命令:

composer require componenta/pipeline

包简介

PSR-15 middleware pipeline for Componenta

README 文档

README

PHP PSR-15 License

PSR-15 middleware pipeline for the Componenta framework.

Installation

composer require componenta/pipeline

The package declares Componenta\Http\Middleware\PipelineConfigProvider in extra.componenta.config-providers. When componenta/composer-plugin is installed, the provider is added to the generated provider list automatically.

Related Packages

Package Why it matters here
psr/http-server-middleware Defines MiddlewareInterface and RequestHandlerInterface.
componenta/app-http Runs HTTP applications on top of the pipeline; concrete middleware and response emission live in separate HTTP packages.
componenta/router Usually sits near the end of the HTTP pipeline.
componenta/middleware-factory Creates middleware from strings, classes, groups, and callables.

Usage

As a top-level handler

use Componenta\Http\Middleware\Pipeline;

$pipeline = new Pipeline(
    [$errorMiddleware, $authMiddleware, $routerMiddleware],
    fallbackHandler: $notFoundHandler,
);

$response = $pipeline->handle($request);

If no fallbackHandler is supplied, EmptyPipelineHandler is installed and throws RuntimeException on invocation — this surfaces misconfiguration of an empty pipeline.

Nested pipelines

A pipeline is itself a middleware, so pipelines compose:

$api = new Pipeline([$apiAuth, $apiRouter]);
$web = new Pipeline([$sessionMiddleware, $webRouter]);

$app = new Pipeline([$errorMiddleware], $notFoundHandler)
    ->pipe($api)
    ->pipe($web);

Via the factory

$pipeline = $factory->createMiddlewarePipeline(
    [$auth, $router],
    $notFoundHandler,
);

Behavior

  • Middleware execute in registration order (FIFO).
  • pipe() returns a new pipeline; the original is not modified.
  • Returning a response from a middleware without calling the next handler halts the chain.
  • Exceptions from middleware and terminal handlers propagate unchanged.

Errors

Condition Exception
Non-middleware element in constructor / pipe() InvalidArgumentException
Pipeline appended to itself via pipe() RuntimeException
Pipeline passed as its own handler to process() RuntimeException
Empty pipeline invoked without a custom fallback RuntimeException

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固