Before releasing Slim 3, the codes below work fine:
settings.php,
return [ 'settings' => [ 'displayErrorDetails' => true, 'modules' => [ 'core' => 'config/core/modules.php', 'local' => 'config/local/modules.php' ], ], ];
index.php
// Instantiate the app $settings = require __DIR__ . '/../src/settings.php'; $app = new \Slim\App($settings); $MyClass = new MyClass($app);
Myclass.php
class MyClass { private $app; public function __construct($app) { $this->app = $app; $local = require $app->settings['modules']['local']; }
But after the release, I get the following error:
Note: Undefined property: Slim \ App :: $ settings in / ...
So, I can no longer use $app->settings ? What should I use then?
php slim-3
laukok
source share