如果你打算从 Slim 2 升级到 Slim 3，这里有一些重要的变化，你必须清楚。
新的 PHP 版本要求
Slim 3 要求 PHP 5.5+
获取 _GET 和 _POST 变量
钩子 / Hooks
Slim v3 不再有钩子的概念。You should consider reimplementing any functionality associated with the default hooks in Slim v2 as middleware instead. If you need the ability to apply custom hooks at arbitrary points in your code (for example, within a route), you should consider a third-party package such as Symfony’s EventDispatcher or Zend Framework’s EventManager.
移除 HTTP 缓存
在 Slim v3 我们将 HTTP 缓存迁移到了单独的模块中： Slim\Http\Cache.
Slim Core has removed Stop/Halt. In your applications, you should transition to using the withStatus() and withBody() methods.
在 Slim v2.x 我们需要使用助手函数 $app->redirect(); 来触发重定向请求。在 Slim v3.x 中，我们可以使用响应类来做这事。
Application middleware is executed as Last In First Executed (LIFE).
Flash messages are no longer a part of the Slim v3 core but instead have been moved to seperate Slim Flash package.
In v3.0 cookies has been removed from core. See FIG Cookies for a PSR-7 compatible cookie component.
Removal of Crypto
In v3.0 we have removed the dependency for crypto in core.
Slim now utilizes FastRoute, a new, more powerful router!
This means that the specification of route patterns has changed with named parameters now in braces and square brackets used for optional segments:
The syntax for adding route middleware has changed slightly. In v3.0:
urlFor() is now pathFor() in the router
urlFor() has been renamed
pathFor() and can be found in the
pathFor() is base path aware.
Container and DI … Constructing
Slim uses Pimple as a Dependency Injection Container.
Request, Response, Uri & UploadFile are immutable.
This means that when you change one of these objects, the old instance is not updated.
Message bodies are streams