chubbyphp/chubbyphp-slim-psr15

This package is abandoned and no longer maintained. No replacement package was suggested.

A slim psr15 adapter for middleware and request handler.

1.1.0 2019-06-20 19:17 UTC

This package is auto-updated.

Last update: 2020-09-22 18:43:19 UTC


README

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

Description

DEPRECATED: Use Slim 4 instead, it got PSR15 support out of the box.

A slim psr15 adapter for middleware and request handler.

Requirements

  • php: ^7.0
  • psr/container: ^1.0
  • psr/http-message: ^1.0.1
  • psr/http-server-middleware: ^1.0.1

Installation

Through Composer as chubbyphp/chubbyphp-slim-psr15.

composer require chubbyphp/chubbyphp-slim-psr15 "^1.1"

Usage

Middleware adapter

<?php

declare(strict_types=1);

namespace App;

use App\Middleware\Psr15Middleware;
use Chubbyphp\SlimPsr15\MiddlewareAdapter;
use Slim\App;

$app = new App();
$app->add(new MiddlewareAdapter(new Psr15Middleware()));

Lazy Middleware adapter

<?php

declare(strict_types=1);

namespace App;

use App\Middleware\Psr15Middleware;
use Chubbyphp\SlimPsr15\LazyMiddlewareAdapter;
use Psr\Container\ContainerInterface;
use Slim\App;

/** @var ContainerInterface $container */
$container = ...;

$app = new App();
$app->add(new LazyMiddlewareAdapter($container, Psr15Middleware::class));

RequestHandler adapter

<?php

declare(strict_types=1);

namespace App;

use App\RequestHandler\Psr15RequestHandler;
use Chubbyphp\SlimPsr15\RequestHandlerAdapter;
use Slim\App;

$app = new App();
$app->get('/', new RequestHandlerAdapter(new Psr15RequestHandler()));

Lazy RequestHandler adapter

<?php

declare(strict_types=1);

namespace App;

use App\RequestHandler\Psr15RequestHandler;
use Chubbyphp\SlimPsr15\LazyRequestHandlerAdapter;
use Psr\Container\ContainerInterface;
use Slim\App;

/** @var ContainerInterface $container */
$container = ...;

$app = new App();
$app->get('/', new LazyRequestHandlerAdapter($container, Psr15RequestHandler::class));

Copyright

Dominik Zogg 2019