but, the full namespace would still be like the first example, so the app knows to prefix “App\Http\Controllers” for every route that uses the class path.
I’ve read through the Router documentation, but I can’t seem to see if it’s possible.
Yes-- If you define your Controller in the container, Slim will find it there. See the Container Resolution (Router Object) section of the docs for details.
If you have something named HomeController in your container, that instantiates App\Http\Controllers\HomeController, you can then just use the shorthand HomeController in your routes.
Or, if you use PHP-DI instead of the provided Pimple, I believe that does support “wildcard” entries which could likely be used to do that without defining it in the container. PHP-DI also gives you autowiring via reflection.
AFAIK this is a PHP feature, nothing to do with Slim. You can import specific classes or full namespaces and use the shorthand notation:
<?php
use Slim\App; // Class import
use App\Http\Controllers\Home; // Namespace import
$app = new App(); // rather than new \Slim\App();
$app->get('/page', Home\HomeController::class);
PD mind that you need to write two colons before the class keyword, not one.