定制 kovagoz/http-middleware-closure-handler 二次开发

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

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

kovagoz/http-middleware-closure-handler

Composer 安装命令:

composer require kovagoz/http-middleware-closure-handler

包简介

PSR-15 compatible HTTP middleware which can utilize closure type request handlers.

README 文档

README

PSR-15 compatible HTTP middleware which can utilize closure type request handlers.

If you don't want to bother about those ugly HTTP controllers and love simplicity, this middleware is your best friend.

phpunit workflow

Requirements

  • PHP >=8.0

Usage

$request = $serverRequestFactory
    ->createServerRequest('GET', '/')
    ->withAttribute('__handler', fn() => 'hello world!');

$middleware = new ClosureHandler($responseFactory, $streamFactory);

$response = $middleware->process($request, $nextHandler);

echo $response->getBody(); // Will print "hello world!"

If no handler found in the request object, or handler is not closure, then the middleware passes the request to the next middleware in the row.

Name of the request attribute (__handler) can be changed by the watchRequestAttribute() method.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固