Closed giovannibr closed 7 years ago
To bind a class directly to root you have to bind it like that:
$app->bindClass('Pages','/');
PHP handles the backslash as root space. You should change your code again, here is no update necessary. if you dont believe, take a look at similar Frameworks like slim/silex every where you see '/' as root and if you look at your domain there is an "/" after the domain :-)
@CyDoor thanks for helping out!
I'm trying to bind a class as the root route. Something like: "http://mysite.com/" showing the "index" method of my class "Pages". And not "http://mysite.com/pages".
I've tried using the second param of bindClass method (alias) with an empty string, like:
$app->bindClass("Pages", "");
But it fails using the "alias" param when an empty string returns false for a soft test at line 778:
$clean = $alias ? $alias : trim(strtolower(str_replace("\\", "/", $class)), "\\");
So, I could fix this changing the bindClass method. The changed lines are 778 and 780:
Maybe you could update it too ;)