Return to Snippet

Revision: 38934
at January 10, 2011 21:19 by afa


Initial Code
<?php
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/iface.IClassLoader.php');
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/iface.IClassPathFinder.php');
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/class.AutoLoader.php');
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/class.ClassLoader.php');
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/class.ClassPathFinder.php');
require_once(dirname(__FILE__).'/private/Afa/Core/AutoLoader/class.InterfacePathFinder.php');
 
$autoLoader = new \Afa\Core\AutoLoader\AutoLoader();
 
$classLoader = new \Afa\Core\AutoLoader\ClassLoader();
$classLoader->setFinder(new Afa\Core\AutoLoader\ClassPathFinder());
$classLoader->setRootDir(dirname(__FILE__).'/private');
$autoLoader->register($classLoader);
 
$interfaceLoader = new \Afa\Core\AutoLoader\ClassLoader();
$interfaceLoader->setFinder(new \Afa\Core\AutoLoader\InterfacePathFinder());
$interfaceLoader->setRootDir(dirname(__FILE__).'/private');
$autoLoader->register($interfaceLoader);
 
\spl_autoload_register(array($autoLoader, 'load'));

Initial URL
http://www.afascripts.com/basics-1-autoloading

Initial Description

                                

Initial Title
Advanced Class/Interface autoloading the PHP 5.3 way

Initial Tags
class, php

Initial Language
PHP