File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ Class Loader
5
5
:maxdepth: 2
6
6
7
7
class_loader
8
+ map_class_loader
8
9
cache_class_loader
9
10
debug_class_loader
Original file line number Diff line number Diff line change
1
+ .. index ::
2
+ single: Class Loader; MapClassLoader
3
+
4
+ MapClassLoader
5
+ ==============
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::
11
+
12
+ require_once '/path/to/src/Symfony/Component/ClassLoader/MapClassLoader';
13
+
14
+ $mapping = array(
15
+ 'Foo' => '/path/to/Foo',
16
+ 'Bar' => '/path/to/Bar',
17
+ );
18
+
19
+ $loader = new MapClassLoader($mapping);
20
+
21
+ $loader->register();
22
+
23
+ .. note ::
24
+
25
+ The default behavior is to append the ``MapClassLoader `` on the autoload
26
+ stack. If you want to use it as the default autoloader, pass ``true ``
27
+ when calling the ``register() `` method. Your class loader will then be
28
+ prepended on the autoload stack.
Original file line number Diff line number Diff line change 3
3
* ** Class Loader**
4
4
5
5
* :doc:` /components/class_loader/class_loader`
6
+ * :doc:` /components/class_loader/map_class_loader`
6
7
* :doc:` /components/class_loader/cache_class_loader`
7
8
* :doc:` /components/class_loader/debug_class_loader`
8
9
You can’t perform that action at this time.
0 commit comments