See: https://php-di.org/doc/frameworks/slim.html Possibility of using DI for response_body attribute injection via the constructor.