|
4 | 4 | The ClassLoader Component |
5 | 5 | ========================= |
6 | 6 |
|
7 | | - The ClassLoader component provides tools to autoload your classes and |
8 | | - cache their locations for performance. |
9 | | - |
10 | 7 | .. caution:: |
11 | 8 |
|
12 | | - The ClassLoader component was deprecated in Symfony 3.3 and it will be |
13 | | - removed in 4.0. As an alternative, use any of the `class loading optimizations`_ |
14 | | - provided by Composer. |
15 | | - |
16 | | -Usage |
17 | | ------ |
18 | | - |
19 | | -Whenever you reference a class that has not been required or included yet, |
20 | | -PHP uses the `autoloading mechanism`_ to delegate the loading of a file |
21 | | -defining the class. Symfony provides three autoloaders, which are able to |
22 | | -load your classes: |
23 | | - |
24 | | -* :doc:`/components/class_loader/class_loader`: loads classes that follow |
25 | | - the `PSR-0`_ class naming standard; |
26 | | - |
27 | | -* :doc:`/components/class_loader/psr4_class_loader`: loads classes that follow |
28 | | - the `PSR-4`_ class naming standard; |
29 | | - |
30 | | -* :doc:`/components/class_loader/map_class_loader`: loads classes using |
31 | | - a static map from class name to file path. |
32 | | - |
33 | | -Additionally, the Symfony ClassLoader component ships with a wrapper class |
34 | | -which makes it possible |
35 | | -:doc:`to cache the results of a class loader </components/class_loader/cache_class_loader>`. |
36 | | - |
37 | | -When using the :doc:`Debug component </components/debug>`, you |
38 | | -can also use a special :ref:`DebugClassLoader <component-debug-class-loader>` |
39 | | -that eases debugging by throwing more helpful exceptions when a class could |
40 | | -not be found by a class loader. |
41 | | - |
42 | | -Installation |
43 | | ------------- |
44 | | - |
45 | | -You can install the component in 2 different ways: |
46 | | - |
47 | | -* :doc:`Install it via Composer </components/using_components>` (``symfony/class-loader`` |
48 | | - on `Packagist`_); |
49 | | -* Use the official Git repository (https://github.com/symfony/class-loader). |
50 | | - |
51 | | -.. include:: /components/require_autoload.rst.inc |
52 | | - |
53 | | -Learn More |
54 | | ----------- |
55 | | - |
56 | | -.. toctree:: |
57 | | - :glob: |
58 | | - :maxdepth: 1 |
59 | | - |
60 | | - class_loader/class_loader |
61 | | - class_loader/class_map_generator.rst |
62 | | - class_loader/debug_class_loader.rst |
63 | | - class_loader/map_class_loader.rst |
64 | | - class_loader/psr4_class_loader.rst |
65 | | - |
66 | | -.. toctree:: |
67 | | - :hidden: |
68 | | - |
69 | | - class_loader/cache_class_loader |
| 9 | + The ClassLoader component was removed in Symfony 4.0. As an alternative, use |
| 10 | + any of the `class loading optimizations`_ provided by Composer. |
70 | 11 |
|
71 | | -.. _PSR-0: http://www.php-fig.org/psr/psr-0/ |
72 | | -.. _PSR-4: http://www.php-fig.org/psr/psr-4/ |
73 | | -.. _`autoloading mechanism`: http://php.net/manual/en/language.oop5.autoload.php |
74 | | -.. _Packagist: https://packagist.org/packages/symfony/class-loader |
75 | 12 | .. _`class loading optimizations`: https://getcomposer.org/doc/articles/autoloader-optimization.md |
0 commit comments