Simple autoloader, but trying to make it psr-compliat I made this class, just to understand what PSR autloader is. I didn't want to download and use it without knowing how it works. So, the one I built is very simple, but I would like a review on how to improve it, and what it lacks to be 100% psr-1 compliant. 

Here is the class loader. 

namespace ClassLoader; 

class Loader
{
    private $classDir; 
    private $namespace; 
    public $dirSeparatorSymbol = '\\'; 

    public function __construct($namespace, $classDir)
    {
        $this-&gt;classDir = $classDir; 
        $this-&gt;namespace = $namespace;

    }

    private function load($class)
    {

        $include_path = str_replace($this-&gt;dirSeparatorSymbol, DIRECTORY_SEPARATOR, $this-&gt;classDir);

        $classFilename = substr($class, strrpos($class, '\\') + 1) . '.php';

        if(file_exists($class = $include_path.$classFilename)){
            require $class;

            return true; 
        }



    }   

    public function register()
    {
        spl_autoload_register([$this, 'load']);
    }
}


Also: You can see the constructor's first argument: __construct($namespace, ... has a namespace param. But I don't know how this is used. The class loads any functions just by doing: 

$a = new ClassLoader\Loader('unused/param', 'path/to/bar');
$a-&gt;register(); 

new bar;
Well, your class is psr-1 compliant. But i think you mean psr-0. 

To have a maximum compliance to the psr-0 autoloader. simply copy paste it...

Your method for instance doesn't work for Class_Name

if you call your autoload with \namespace\ClassName the first \ doesn't get trimmed. This will leed to problems. (php will load /path/to/lib//namespace/ClassName.php)

as mentioned in the comments, the use of the $this->dirSeparatorSymbol is weird. You don't need it. so don't use it.

Edit: 'unused' namespace

Often you will have multiple libraries at different places. Your own will probably reside under ROOT.'/lib/' but other libraries you downloaded should/will be under ROOT.'/vendor/AwesomeLibrary/src/'. to accomodate this. You will register 2 autoloaders:

$personalLoader = new ClassLoader\Loader('Personal','/lib/');
$personalLoader->register();

$awesomeLoader = new ClassLoader\Loader('AwesomeLibrary','/vendor/AwesomeLibrary/src/');
$awesomeLoader->register();

Now your autoloader should check or it is allowed to load the file. For instance if I use
AwesomeLibrary/MyClass; the personal loader shouldn't do anything since it knows nothing about AwesomeLibrary. the second awesomeLoader however knows how to load the AwesomeLibrary.