PHP autoload class design for a framework

I'm developing a php framework called Stack. I just created the autoload.php as follows.

<?php
namespace Stack\Application;

define('ROOT', __DIR__);
class AutoLoader
{
private static $pos = false; private static$namespace_path = NULL;
private static $namespace_name = NULL; private static$file = NULL;
/**
* Set qualified name Stack\Application
*/
public static function register()
{
spl_autoload_register('Stack\Application\AutoLoader::useNamespace');
}
public function unregister()
{
spl_autoload_unregister('Stack\Application\AutoLoader::useNamespace');
}
private static function useNamespace($namespace) { /** * @var$namespace namespace name
* @var $pos — Find the position of the last occurrence of a class in a fully qulified$namespace
*/
if (false !== $pos = strrpos($namespace, '\\')) {
$pos = strrpos($namespace, '\\');
$namespace_path = str_replace('\\', DIRECTORY_SEPARATOR, substr($namespace, 0, $pos)) . DIRECTORY_SEPARATOR;$namespace_name = substr($namespace,$pos + 1);
$file = ROOT . DIRECTORY_SEPARATOR . '../..' . DIRECTORY_SEPARATOR .$namespace_path . $namespace_name . '.php'; if (!file_exists($file)) {
return false;
}
include $file; } } }  Bootstrap.php <?php require_once __DIR__.'/AutoLoader.php'; use Stack\Application\AutoLoader as App; App::register(); ?>  index.php <?php require_once __DIR__.'/../Application/Bootstrap.php';$model = new Stack\Application\Models\Model();

$controller = new Stack\Application\Controllers\Controller($model);

$view = new Stack\Application\Views\View($model);

echo \$view->output();

?>


My directory structure of the framework as follows

 - Stack
--Application
---configs
---docs
---layouts
---modules
---Views
---Controllers
---forms
---Models
---services
---AutoLoader.php
---Bootstrap.php
--data
--docs
--library
--public
---index.php
--scripts
--temp


I'm going to keep same namespace name for the corresponding directory structure. Am i doing this right ?

• Why don't you use composer for autoloading? – tkausl Nov 14 '15 at 12:04
• But lot of frameworks are still using autoload – underscore Nov 14 '15 at 12:33
• A lot of frameworks use composer for autoloading – tkausl Nov 14 '15 at 12:36
• A lot of frameworks use custom autoloads only when it need some additional logic for autoloading classes, you don't need it, use conposer autoloader – user89569 Nov 14 '15 at 14:32
• Don't reinvent the wheel (composer) unless you can do it better. Spend your time inventing wheels that don't already exist. – AD7six Nov 15 '15 at 17:20