spl_autoload with namespace

I am makeing a small framework for scheduled job that are run by a nodejs external process. I would like to use an auto loader but for some reason data is not getting to it. I am also using namespaces. Here is what my folder structure looks like:

Library
  |_ Core
     |_ JobConfig.php
  |_ Utilities
     |_ Loader.php
  |_ Scheduled
     |_ SomeJob.php
  |_ Config.php

My Config.php just has some definitions and an instance of my Loader.php.

Loader.php looks like:

public function __constructor()
{
    spl_autoload_register(array($this, 'coreLoader'));
    spl_autoload_register(array($this, 'utilitiesLoader'));
}

private function coreLoader($class)
{
    echo $class;
    return true;
}

private function utilitiesLoader($lass)
{
    echo $class;
    return true;
}

So for my SomeJob.php I am including Config.php and then try to instantiate JobConfig.php when it fails. My namespaces look like Library\Core\JobConfig and so on. I am not sure if this is the best approach without the ability to bootsrapt things. But I am not seeing the echo’s from the loader before it fails.

You may want to fix this, and retry:

__constructor() should be __construct()

OMG Thanks!!!

I’ve done worse, no worries :smiley:

Yech typos. I’d recommend use of an IDE for you, like netbeans or eclipse. These IDE will tell you an error or a typo you make, and speed up your work by magnitudes. If you use an IDE, you will be quickly notified or the constructor method error.