I'm stuck on what is the best way to have libraries, models and helpers loaded.
I like how Code Igniter does it, but a lot of other frame works use static loader class that works with __autoload.
Example:
Code: Select all
<?php
class Loader {
static protected $data = array();
static public function register($class, $file) {
self::data[$class] = $file;
}
static public function load($class) {
if (isset(self::data[$class])) {
include(self::data[$class]);
} else {
exit('Error: Could not load ' . $class . '!');
}
}
}
function __autoload($class) {
Loader::load($class);
}
?>
Loader::register('Config', 'library/config.php');
Also Code Igniter does not cover factories. Some core classes may need some additional tweaking before returning a new object..
What I need is something to cover plain object creation, singletons, factories and storing object states in a registry.