diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache
index 9bba236a75839c0da260719113b0c5c9bb0526dd..9ab1ed336f9caacd19f31cdb0bdc3ffc2c20b99a 100644
--- a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache
@@ -116,14 +116,17 @@ class SlimRouter
     /**
      * Class constructor
      *
-     * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings
+     * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings
      *
      * @throws InvalidArgumentException When no container is provided that implements ContainerInterface
      * @throws Exception When implementation class doesn't exists
      */
-    public function __construct($container = [])
+    public function __construct($settings = [])
     {
-        $this->slimApp = new App($container);
+        $this->slimApp = new App($settings);
+
+        // middlewares requires Psr\Container\ContainerInterface
+        $container = $this->slimApp->getContainer();
 
         {{#hasAuthMethods}}
         $authPackage = '{{authPackage}}';
diff --git a/samples/server/petstore/php-slim/lib/SlimRouter.php b/samples/server/petstore/php-slim/lib/SlimRouter.php
index 4d30e8f40a8ee26e25368eaffa428316f0d5a641..94fc95ef8a316b8685a6dc752ad7f8bd8ed8b36a 100644
--- a/samples/server/petstore/php-slim/lib/SlimRouter.php
+++ b/samples/server/petstore/php-slim/lib/SlimRouter.php
@@ -577,14 +577,17 @@ class SlimRouter
     /**
      * Class constructor
      *
-     * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings
+     * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings
      *
      * @throws InvalidArgumentException When no container is provided that implements ContainerInterface
      * @throws Exception When implementation class doesn't exists
      */
-    public function __construct($container = [])
+    public function __construct($settings = [])
     {
-        $this->slimApp = new App($container);
+        $this->slimApp = new App($settings);
+
+        // middlewares requires Psr\Container\ContainerInterface
+        $container = $this->slimApp->getContainer();
 
         $authPackage = 'OpenAPIServer\Auth';
         $basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {