定制 maduser/argon-http 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

maduser/argon-http

Composer 安装命令:

composer require maduser/argon-http

包简介

HTTP kernel and response emitter for the Argon runtime stack.

README 文档

README

PHP Build codecov Psalm Level Latest Version Downloads License: MIT

maduser/argon-http is the HTTP runtime adapter for Argon applications. It provides the kernel and response emitter that Prophecy can use after the container, routing, middleware, and error packages have been registered.

The package is intentionally small:

  • Kernel runs the HTTP request lifecycle.
  • ResponseEmitter emits PSR-7 responses to SAPI.
  • HttpKernelServiceProvider binds the kernel and emitter into an ArgonContainer.

It does not define routes, build middleware stacks, format exceptions, or create PSR-7 messages. Those responsibilities belong to the routing, middleware, error, and HTTP message packages.

Installation

composer require maduser/argon-http

For a complete HTTP stack, applications normally combine this package with:

  • maduser/argon-prophecy
  • maduser/argon-http-message
  • maduser/argon-routing
  • maduser/argon-middleware
  • maduser/argon-error

Service Provider

Register the HTTP provider during application boot:

use Maduser\Argon\Container\ArgonContainer;
use Maduser\Argon\Http\Provider\HttpKernelServiceProvider;

$container = new ArgonContainer();
$container->register(HttpKernelServiceProvider::class);

The provider binds:

  • Maduser\Argon\Contracts\Handler\AppHandlerInterface to Kernel
  • Psr\Http\Message\ServerRequestInterface through the HTTP message server-request factory
  • Maduser\Argon\Support\Contracts\ResponseEmitterInterface to ResponseEmitter

The server request binding is only registered when the application has not already provided one. It uses a normal factory binding, not a closure, so the container can still be compiled. This keeps tests, workers, and custom front controllers in control while giving normal SAPI front controllers a useful default.

The kernel expects the container to resolve a RequestHandlerInterface. In the full Argon HTTP stack that is usually provided by maduser/argon-routing and maduser/argon-middleware.

Exit Behaviour

By default the provider sets kernel.shouldExit from the runtime environment:

  • APP_ENV=testing disables hard exits.
  • all other environments allow the kernel to exit after emitting a response.

Applications can set kernel.shouldExit before registering the provider to override that default.

Error Handling

The HTTP kernel deliberately does not catch or format exceptions. Runtime throwables are coordinated by Prophecy and the error package so the kernel stays focused on three operations:

  1. process the request through a PSR-15 request handler;
  2. emit the returned PSR-7 response;
  3. terminate with an exit code derived from the response status.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固