Ordinarily I see complex autoloading solutions that require the user to hydrate them with a pre-defined set of paths/directories with which to look through when autoloading a class. Or they have a complex glob-like search which then builds a cache file to reduce the lookup time etc.
However, I noticed that as long as you namespace each class, and those namespaces match the directory structure that contains them, then your autoloader does not need to be any more complicated than this:
spl_autoload_register(function ($class) {
include $class . '.php';
});
Assuming you don't have to work with non-namespaced 3rd party classes, is there ever a reason NOT to namespace your classes according to your folder structure, and then let spl_autoload_register handle everything for you?
Is there a pitfall to this that I am overlooking?