Skip to content

Adding middlewares #4

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions