The ClassLoader ComponentEdit this page
Warning: You are browsing the documentation for Symfony 2.5, which is no longer maintained.
Read the updated version of this page for Symfony 6.3 (the current stable version).
The ClassLoader component provides tools to autoload your classes and cache their locations for performance.
Whenever you reference a class that has not been required or included yet, PHP uses the autoloading mechanism to delegate the loading of a file defining the class. Symfony provides three autoloaders, which are able to load your classes:
- The PSR-0 Class Loader: loads classes that follow the `PSR-0` class naming standard;
- The PSR-4 Class Loader: loads classes that follow the `PSR-4` class naming standard;
- MapClassLoader: loads classes using a static map from class name to file path.
Additionally, the Symfony ClassLoader component ships with a set of wrapper classes which can be used to add additional functionality on top of existing autoloaders: