


The ClassLoader Component

The ClassLoader Component

The ClassLoader component provides tools to autoload your classes and cache their locations for performance.


The ClassLoader component was deprecated in Symfony 3.3 and it will be removed in 4.0. As an alternative, use Composer’s class loading mechanism.


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:

Additionally, the Symfony ClassLoader component ships with a wrapper class which makes it possible to cache the results of a class loader.

When using the Debug component, you can also use a special DebugClassLoader that eases debugging by throwing more helpful exceptions when a class could not be found by a class loader.


$ composer require symfony/class-loader

Alternatively, you can clone the https://github.com/symfony/class-loader repository.


