2017 © Pedro Peláez
 

library middleware-msgpack

PSR-7 Middleware of msgpack.org

image

titaniumcodes/middleware-msgpack

PSR-7 Middleware of msgpack.org

  • Tuesday, October 10, 2017
  • by rakshazi
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

PSR-7 Msgpack middleware

Msgpack packer as PSR-7 middleware. It will pack all response body contents and set new Content-Type header, (*1)

Usage

Slim framework example, (*2)

<?php
require 'vendor/autoload.php';

$body = new \Slim\Http\Body(fopen('php://temp', 'r+')); //empty body for new response, can be replaced with any other implementation of PSR-7 StreamInterface
$config = [
    'config_dir' => __DIR__.'/config',
    'settings' => [
        'displayErrorDetails' => true,

        'logger' => [
            'name' => 'slim-app',
            'path' => __DIR__ . '/../logs/app.log',
        ],
    ],
];

$app = new \Slim\App($config);
$app->add(new \TitaniumCodes\Middleware\Msgpack($body, 'application/x-msgpack'));
$app->get('/', function ($request, $response, $args) use($config) {
    return $response->withJson($config);
});
$app->run();

TiSuit integration

config msgpack.php:, (*3)

<?php
return [
    'body' => new \Slim\Http\Body(fopen('php://temp', 'r+'));
    'content-type' => 'application/x-msgpack',
];

config suit.php:, (*4)

<?php
return [
    //...
    'providers' => [
        '\TitaniumCodes\Middleware\MsgpackProvider',
        //...
    ],
    'middlewares' => [
        'msgpack_middleware',
        //...
    ],
];

The Versions

10/10 2017

dev-master

9999999-dev

PSR-7 Middleware of msgpack.org

  Sources   Download

MIT

The Requires

  • ext-msgpack *
  • psr/http-message-implementation *

 

10/10 2017

dev-alexandr-lipov-patch-1

dev-alexandr-lipov-patch-1

PSR-7 Middleware of msgpack.org

  Sources   Download

MIT

The Requires

  • ext-msgpack *
  • psr/http-message-implementation *

 

09/10 2017

1.0.1

1.0.1.0

PSR-7 Middleware of msgpack.org

  Sources   Download

MIT

The Requires

  • ext-msgpack *
  • psr/http-message-implementation *

 

09/10 2017

1.0.0

1.0.0.0

PSR-7 Middleware of msgpack.org

  Sources   Download

MIT

The Requires

  • ext-msgpack *
  • psr/http-message-implementation *