// PSR-0: namespace separators and underscores both become directories
spl_autoload_register(function ($class) {
$name = str_replace(array('\', '_'), DIRECTORY_SEPARATOR, ltrim($class, '\'));
$path = __DIR__ . '/lib/' . $name . '.php';
if (is_readable($path)) {
require $path;
}
});