chubbyphp/chubbyphp-lazy-middleware

该软件包已被废弃,不再维护。未建议替代软件包。

Chubbyphp 懒中间件

1.1.0 2018-05-18 05:43 UTC

This package is auto-updated.

Last update: 2020-09-22 18:44:18 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Monthly Downloads Latest Stable Version Latest Unstable Version

描述

已弃用:Slim3中的中间件已经是懒加载的...

重要:如果您对psr-15中间件的懒加载适配器感兴趣,我建议使用chubbyphp/chubbyphp-slim-psr15。同样适用于搜索psr-15请求处理器。

允许懒加载中间件。

要求

  • php: ~7.0
  • psr/container: ~1.0
  • psr/http-message: ~1.0

安装

通过Composer安装chubbyphp/chubbyphp-lazy-middleware

composer require chubbyphp/chubbyphp-lazy-middleware "~1.1"

用法

<?php

use Chubbyphp\Lazy\LazyMiddleware;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;

$container['service'] = function (Request $request, Response $response) {
    // run some lazy logic
};

$middleware = new LazyMiddleware($container, 'service');
$response = $middleware($request, $response);

版权

Dominik Zogg 2016