Autoload allows you to use files without including them; in fact they are automatically included on the fly. It is a PHP feature that will run callback functions everytime an unknown class is encountered. These function then try to locate and load the required file on the fly, without the developer having to include it herself. For more informations about this feature, see the PHP documentation.
Web:Extend provides its own autoload handler in the weeAutoload class.
weeAutoload::loadClass() is called every time a class needs to be loaded.
For example, weeAutoload::loadClass('weeForm') will include the file wee/form/weeForm.class.php.
To add a path to autoload, you can use weeAutoload::addPath('/path/to/autoload').
You can add this call in your bootstrap script (e.g index.php), just after require('wee/wee.php');.
All the files named CLASSNAME.class.php with CLASSNAME the name of the class defined in the file will be loaded automatically.
weeAutoload will scan every directory which has been passed to its addPath() method and build a map from classnames to filenames.
Since scanning all these directories is a very intensive operation, Web:Extend will cache the listing of the files found during the first scan.
On all subsequent requests, the cache file will be loaded directly.
The cache file is located by default at app/tmp/autoload.php.
If you wish to change this path, you can define the constant WEE_AUTOLOAD_CACHE
in your bootstrap script (e.g index.php) and set it to the path you need.
The cache is enabled by default, unless DEBUG is defined.
This allows you to not have to worry about enabling the cache on production servers or disabling it while developing.
If you need to disable the cache without enabling DEBUG,
you can either comment WEE_AUTOLOAD_CACHE or define the constant NO_CACHE.
Keep in mind that disabling caching will greatly reduce the performances of your application.