承接 northwoods/conditional-middleware 相关项目开发

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

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

northwoods/conditional-middleware

最新稳定版本:1.0.0

Composer 安装命令:

composer require northwoods/conditional-middleware

包简介

Middleware proxy for request condition checks

README 文档

README

Build Status Code Quality Code Coverage Latest Stable Version Total Downloads License

Middleware proxy that executes a middleware based on request conditions.

Installation

The best way to install and use this package is with composer:

composer require northwoods/conditional-middleware

Usage

use Northwoods\Middleware\ConditionalMiddleware;

/** @var \Psr\Http\Server\MiddlewareInterface */
$actual = /* any existing middleware */

$middleware = new ConditionalMiddleware($actual, function (Request $request): bool {
    return $request->getHeaderLine('accept') === 'application/json';
});

In this example, the wrapped $actual middleware will only be executed if the request accepts the application/json content type.

Condition Callable

The condition callable should use the following signature:

function (Request $request): bool;

The condition must return true (by strict === comparison) for the wrapped middleware to be executed. If the condition check fails the handler will be called immediately.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固