The autoload module - is utility. It allows other modules to leverage PHP5 class autoloading capabilities in a unified fashion.

Requirements:

  • PHP 5.1.2 for Drupal 6 (unsupported)
  • PHP 5.3.0 for Drupal 7

You do not need this module unless you are developing a module that makes use of classes or you are installing a module that depends on this one.

PLEASE, READ THE DOCUMENTATION BEFORE USAGE!

7.x

Let module know about the objects. To do this, go to module's *.info file and configure the autoload directive, were keys are subdirectories inside of the module directory and values - are namespace bases. As much as needed directories and namespace bases could be added by such way.

Example

You able to use one of or both of known autoloading standards. CTools API is already used this functionality.

PSR-0

; All objects, namespace path of which starts from "CTools",
; will be searched inside of "<MODULE_PATH>/psr-0".
autoload[psr-0][] = CTools

PSR-4

; All objects, namespace path of which starts from "CTools\Plugins",
; will be searched inside of "<MODULE_PATH>/psr-4".
autoload[psr-4][] = CTools\Plugins

6.x

The 1.x branch uses a manual info-hook. The 2.x branch includes a backport of the Drupal 7 self-learning registry as well as the info hook for backward compatibility.

Leveraging this module for Drupal 6 class-using modules, however, will make moving to Drupal 7 easier.

See the included README.txt file for information on how to use this module in your own modules.

NOTE: Remember to clear all caches in your module's hook_enable() if your module relies on autoload. Autoload information is cached and your class may not be found if the autoload cache is not cleared.

Supporting organizations: 
Development and testing

Project Information

Downloads