directorys = array( __DIR__ . "/utils/", __DIR__ . "/models/", __DIR__ . "/providers/", ); } /** * Registers the autoloader class with the PHP SPL autoloader. * * @param bool $prepend Prepend the autoloader on the stack instead of appending it. */ public static function register($prepend = false) { spl_autoload_register(array(new self(), 'autoload'), true, $prepend); } /** * Loads a class from a file using its fully qualified name. * * @param string $className Fully qualified name of a class. */ public function autoload($className) { foreach ($this->directorys as $dir) { $filepath = $dir . $className . '.php'; if (is_file($filepath)) { require $filepath; break; } } } }