I'm currently building a project to learn the Slim framework. I have a pretty good basic understanding of Slim but namespaces are still quite confusing to me. I'm storing my routes in separate files based on what page they relate to (home, about, add, etc). The issue is that I cannot create a Request or Response object without using
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
at the top of each route file. Is there a way I can put the use at the top of my main routes file and have every included file use it?
For example, my routes.php file is included in my start.php file which is included in my index.php. Inside my routes file has includes to each specific route home.php, about.php, add.php, etc. Each file included in my routes.php has to have a use statement otherwise I cannot access Response and Request without namespacing them.