Location: PHPKode > scripts > Class Manager > class-manager/usage.php


// loading default configuration (classpath.xml)

// using the classes right away
new TestClass1();
new TestClass2();
new TestClass3();
new LookedupClass();
new LookedupTemplate();
new LookedupRecursive();

// loading additional classes using XML

// its best to use relative paths in the classpath xmls, so it will be more independent from the concrete running environment. Those relative paths are relative to the currently running script. 
// it's possible to load an XML with a different "root" path that will be put in front of all the repository paths found in the XML file: 
// ClassManager::instance()->loadDefaultXml('c:/php/myclasses');
// ClassManager::instance()->loadXml('../..');

// loading additional class through interface
// ClassManager::instance()->addPath('MyNewClass', 'myClassDir/MyNewClass.php');

// adding additional auto lookup paths

// adding additional auto lookup paths with custom file name template
ClassManager::instance()->addLookupPath('/php/myclassesTemplate/', '{className}.class.php');

// testing file existence

// forcing require on all specified class sources

// generate PHP code to add classpath
$phpCode = ClassManager::instance()->generatePhpClassPathDump();

echo 'Test successful'

Return current item: Class Manager