Classmap generation with XAutoload
Last updated on
30 April 2025
Both hook_xautoload() and hook_libraries_info() allow to add directories for classmap discovery.
See LocalDirectoryAdapter::addClassmapSources().
function hook_xautoload($adapter) {
// Scan files in path/to/module/includes/* for classes.
$adapter->addClassmapSources(array('includes'));
}
The discovery will be cached in the regular Drupal cache.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion