$app = \Slim\Slim::getInstance();
was removed because it’s a bad practice.
If you need the Slim\App
in your middleware you will have to inject it (via the constructor)
But seeing what you are after you don’t need the app instance. You could use the Route
arguments to pass stuff from one middleware to another.
/** @var $route \Slim\Route */
$route = $request->getAttribute('route');
$route->setArgument('user', $user);
// other middleware ...
/** @var $route \Slim\Route */
$route = $request->getAttribute('route');
$user = $route->getArgument('user');