Get params in middleware


I’ve a strange issue that i don’t understand.

I defined a extended class from Slim/App (with this following code)

class App extends Slim\App
public function __construct($config = [])
    if (!isset($config)) $config = [];

    // define Slim Settings
    $config = [
        'settings' => [
            'httpVersion' => '1.1',
            'responseChunkSize' => 4096,
            'outputBuffering' => 'append',
            'displayErrorDetails' => DEBUG,
            'determineRouteBeforeAppMiddleware' => true,
            'addContentLengthHeader' => true,
            'routerCacheFile' => false,
        'configFile' => $config,


    $container = $this->getContainer();


The dump show the ‘determineRouteBeforeAppMiddleware’ value : “true” (it’s good)

I use this following code to dump the $params object in the middleware (cf: last answer on

public function __invoke(Request $request, Response $response, callable $next)
    $logger = $this->di->logger;
    $logger->addDebug("Middleware ValidationArgs start");
    try {
        $route = $request->getAttribute('route');
        $params = $route->getArguments();

I get this result with a GET on “” :

array(0) {

Why i don’t get an array with parameter ‘test’…?

There is something, i did not understand but what ?

Thanks for your help

test is a query parameter, not a route argument. Hence you can get at it using:

$test = $request->getParam('test');

It’s right, thanks :slight_smile: