File tree 3 files changed +34
-17
lines changed
3 files changed +34
-17
lines changed Original file line number Diff line number Diff line change 1
1
.. index ::
2
- single: Class Loader; MapClassLoader
2
+ single: Class Loader; PSR-0 Class Loader
3
3
4
4
The PSR-0 Class Loader
5
5
======================
@@ -10,11 +10,11 @@ Introduction
10
10
.. versionadded :: 2.1
11
11
The ``ClassLoader `` class was added in Symfony 2.1.
12
12
13
- If your classes and third-party libraries follow the `PSR-0 `_ standards or the
14
- ` PEAR `_ naming conventions, you can use the :class: `Symfony\\ Component\\ ClassLoader\\ ClassLoader `
15
- class to load all of your project's classes.
13
+ If your classes and third-party libraries follow the `PSR-0 `_ standards, you
14
+ can use the :class: `Symfony\\ Component\\ ClassLoader\\ ClassLoader ` class to
15
+ load all of your project's classes.
16
16
17
- .. note ::
17
+ .. tip ::
18
18
19
19
You can use both the ``ApcClassLoader `` and the ``XcacheClassLoader `` to
20
20
:doc: `cache</components/class_loader/cache_class_loader> ` a ``ClassLoader ``
@@ -66,7 +66,7 @@ register your classes::
66
66
'Twig_' => __DIR__.'/vendor/twig/twig/lib',
67
67
));
68
68
69
- Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be looked
69
+ Classes from a sub-namespace or a sub-hierarchy of ` PEAR `_ classes can be looked
70
70
for in a location list to ease the vendoring of a sub-set of classes for large
71
71
projects::
72
72
Original file line number Diff line number Diff line change
1
+ .. index ::
2
+ single: Components; Class Loader
3
+
1
4
The Class Loader Component
2
5
==========================
3
6
4
- The Class Loader Component loads your project classes automatically.
7
+ The Class Loader Component provides tools to load and cache your project
8
+ classes automatically.
9
+
10
+ Usage
11
+ -----
5
12
6
13
Whenever you use an undefined class, PHP uses the autoloading mechanism to
7
14
delegate the loading of a file defining the class. Symfony2 provides two
8
15
autoloaders, which are able to load your classes:
9
16
10
- * :doc: `A PSR-0 class loader<class_loader> `
11
-
12
- * :doc: `Load classes based on class-to-file mapping<map_class_loader> `
17
+ * :doc: `A PSR-0 class loader</components/class_loader/class_loader> `
18
+ * :doc: `Load classes based on class-to-file mapping</components/class_loader/map_class_loader> `
13
19
14
20
Additionally, the Symfony Class Loader Component ships with a set of wrapper
15
21
classes which can be used to add additional functionality on top of existing
16
22
autoloaders:
17
23
18
- * :doc: `cache_class_loader `
19
-
20
- * :doc: `debug_class_loader `
24
+ * :doc: `/components/class_loader/cache_class_loader `
25
+ * :doc: `/components/class_loader/debug_class_loader `
21
26
22
27
Installation
23
28
------------
Original file line number Diff line number Diff line change 4
4
MapClassLoader
5
5
==============
6
6
7
- Additionally to any dynamic class loader (like the :doc: `PSR-0 class loader <class_loader >`)
8
- you can use the :class: `Symfony\\ Component\\ ClassLoader\\ MapClassLoader ` to statically
9
- map classes to files. Using it is as easy as passing your mapping to its constructor
10
- when creating an instance of the ``MapClassLoader `` class::
7
+ Introduction
8
+ ------------
9
+
10
+ Additionally to any dynamic class loader (like the
11
+ :doc: `PSR-0 class loader</components/class_loader/class_loader> `) you can use
12
+ the :class: `Symfony\\ Component\\ ClassLoader\\ MapClassLoader ` to statically map
13
+ classes to files. This is useful if you use third-party libraries which don't
14
+ follow the `PSR-0 `_ standards.
15
+
16
+ Usage
17
+ -----
18
+
19
+ Using it is as easy as passing your mapping to its constructor when creating
20
+ an instance of the ``MapClassLoader `` class::
11
21
12
22
require_once '/path/to/src/Symfony/Component/ClassLoader/MapClassLoader';
13
23
@@ -26,3 +36,5 @@ when creating an instance of the ``MapClassLoader`` class::
26
36
stack. If you want to use it as the default autoloader, pass ``true ``
27
37
when calling the ``register() `` method. Your class loader will then be
28
38
prepended on the autoload stack.
39
+
40
+ .. _PSR-0 : http://symfony.com/PSR0
You can’t perform that action at this time.
0 commit comments