PHP-DI / Slim-Bridge

PHP-DI integration with the Slim framework
http://php-di.org/doc/frameworks/slim.html
MIT License
176 stars 38 forks source link

middleware in docs #59

Closed zabakala closed 4 years ago

zabakala commented 4 years ago

Hi. In your Readme.md there is the following example:

$app->add(function ($request, $response, $next) {
    $request = $request->withAttribute('name', 'Bob');
    return $next($request, $response);
});

... but it generates the following err:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Closure::{closure}(), 2 passed in /.../vendor/slim/slim/Slim/MiddlewareDispatcher.php on line 283 and exactly 3 expected in...

mnapoli commented 4 years ago

Hi, good catch!

Slim middlewares have indeed changed a little bit in the new version 4. Here are more details: https://www.slimframework.com/docs/v4/concepts/middleware.html

Would you be able to send a pull request to update the example?