Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x - MiddlewareDispatcherInterface #2817

Merged
merged 9 commits into from Aug 20, 2019

Conversation

@l0gicgate
Copy link
Contributor

commented Aug 20, 2019

Closes #2785

This PR enables users to inject their own MiddlewareDispatcher into the App component.

The new proposed interface:

<?php
declare(strict_types=1);

namespace Slim\Interfaces;

use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

interface MiddlewareDispatcherInterface extends RequestHandlerInterface
{
    /**
     * Add a new middleware to the stack
     *
     * Middleware are organized as a stack. That means middleware
     * that have been added before will be executed after the newly
     * added one (last in, first out).
     *
     * @param MiddlewareInterface|string|callable $middleware
     * @return self
     */
    public function add($middleware): self;

    /**
     * Add a new middleware to the stack
     *
     * Middleware are organized as a stack. That means middleware
     * that have been added before will be executed after the newly
     * added one (last in, first out).
     *
     * @param MiddlewareInterface $middleware
     * @return self
     */
    public function addMiddleware(MiddlewareInterface $middleware): self;

    /**
     * Seed the middleware stack with the inner request handler
     *
     * @param RequestHandlerInterface $kernel
     * @return void
     */
    public function seedMiddlewareStack(RequestHandlerInterface $kernel): void;
}

@l0gicgate l0gicgate added the Slim 4 label Aug 20, 2019

@l0gicgate l0gicgate added this to the 4.2.0 milestone Aug 20, 2019

@l0gicgate l0gicgate force-pushed the l0gicgate:MiddlewareDispatcherInterface branch from 7b99abf to e41d1aa Aug 20, 2019

@l0gicgate l0gicgate force-pushed the l0gicgate:MiddlewareDispatcherInterface branch from e41d1aa to 8e0f835 Aug 20, 2019

@l0gicgate l0gicgate force-pushed the l0gicgate:MiddlewareDispatcherInterface branch from a2d911a to aed55cf Aug 20, 2019

@coveralls

This comment has been minimized.

Copy link

commented Aug 20, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling e830a8c on l0gicgate:MiddlewareDispatcherInterface into 89f8076 on slimphp:4.x.

@l0gicgate l0gicgate requested a review from adriansuter Aug 20, 2019

@adriansuter
Copy link
Contributor

left a comment

Excellent.

Slim/MiddlewareDispatcher.php Show resolved Hide resolved
Slim/MiddlewareDispatcher.php Show resolved Hide resolved
tests/AppTest.php Show resolved Hide resolved

@l0gicgate l0gicgate force-pushed the l0gicgate:MiddlewareDispatcherInterface branch from ee81384 to e830a8c Aug 20, 2019

@l0gicgate l0gicgate requested a review from adriansuter Aug 20, 2019

@l0gicgate l0gicgate merged commit a0435c3 into slimphp:4.x Aug 20, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 100.0%
Details

@l0gicgate l0gicgate deleted the l0gicgate:MiddlewareDispatcherInterface branch Aug 20, 2019

@l0gicgate l0gicgate referenced this pull request Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.