Skip to content

Adding middlewares #4

@mashit

Description

@mashit

Nice way to add MVC pattern to a Slim application. cheers!

I would like to run Slim middleware using this approach.

In a regular slim application, one would write

$app = new \Slim\Slim();
$app->add(new \AllCapsMiddleware());
$app->run();

To achieve this in Slim-MVC

I tweaked Router.php processCallback

$class = new $class();
$class->add(new \Slim\Middleware\ContentTypes());
$class->runMiddleware();

Controller.php

public function runMiddleware(){                             
          $this->middleware[0]->call();                                                   
}

I am wondering if there is a better approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions