2017 © Pedro Peláez
 

library chubbyphp-psr7-middleware-singlepass-to-multipass-adapter

Chubbyphp Psr7 Middleware Adapter

image

chubbyphp/chubbyphp-psr7-middleware-singlepass-to-multipass-adapter

Chubbyphp Psr7 Middleware Adapter

  • Friday, April 20, 2018
  • by dominikzogg
  • Repository
  • 0 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

chubbyphp-psr7-middleware-singlepass-to-multipass-adapter

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality Code Coverage, (*1)

Description

This adapter can be used, if you dlike to use single pass (no response argument given) middleware within a multipass environment as for example slim or [zend-expressive][3] are., (*2)

Requirements

  • php: ~5.4
  • psr/http-message: ~1.0

Installation

Through Composer as chubbyphp/chubbyphp-psr7-middleware-singlepass-to-multipass-adapter., (*3)

composer require chubbyphp/chubbyphp-psr7-middleware-singlepass-to-multipass-adapter "~1.0"

Usage

The variable $next, within the single pass middleware arguments will always be a \Closure from the adapter., (*4)

<?php

use Chubbyphp\Psr7SinglePassToMultiPassAdapter\Psr7SinglePassToMultiPassAdapter;

$existingSinglePassMiddleware = function (RequestInterface $request, callable $next) {
    $request = $request->withHeader('X-Custom', '1');

    $response = $next($request);

    $body = $response->getBody();
    $body->seek(0, SEEK_END);
    $body->write('<!-- provided by x-custom -->');

    return $response;
};

$adapter = new Psr7SinglePassToMultiPassAdapter($existingSinglePassMiddleware);

$response = $adapter($request, $response, $next);

Dominik Zogg 2016, (*5)

The Versions

20/04 2018

dev-master

9999999-dev

Chubbyphp Psr7 Middleware Adapter

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

middleware psr-7 psr7 multipass chubbyphp singlepass

05/05 2017

1.0.2

1.0.2.0

Chubbyphp Psr7 Middleware Adapter

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

middleware psr-7 psr7 multipass chubbyphp singlepass

26/04 2017

1.0.1

1.0.1.0

Chubbyphp Psr7 Middleware Adapter

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

middleware psr-7 psr7 multipass chubbyphp singlepass

10/10 2016

1.0.0

1.0.0.0

Chubbyphp Psr7 Middleware Adapter

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

middleware psr-7 psr7 multipass chubbyphp singlepass

29/09 2016

1.0.0-alpha1

1.0.0.0-alpha1

Chubbyphp Psr7 Middleware Adapter

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

middleware psr-7 psr7 multipass chubbyphp singlepass