Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 2.06 KB

class_loader.rst

File metadata and controls

65 lines (46 loc) · 2.06 KB
.. index::
    single: Components; ClassLoader

The ClassLoader Component

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

Caution!

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.

Usage

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 :doc:`to cache the results of a class loader </components/class_loader/cache_class_loader>`.

When using the :doc:`Debug component </components/debug>`, you can also use a special :ref:`DebugClassLoader <component-debug-class-loader>` that eases debugging by throwing more helpful exceptions when a class could not be found by a class loader.

Installation

You can install the component in 2 different ways:

Learn More

.. toctree::
    :glob:
    :maxdepth: 1

    class_loader/class_loader
    class_loader/*