Skip to content

Commit d04c5c9

Browse files
committed
docs: add "Improve Performance"
1 parent e5d7d3f commit d04c5c9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

user_guide_src/source/concepts/autoloader.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,36 @@ By default, it looks for Composer's autoload file at
101101
``ROOTPATH . 'vendor/autoload.php'``. If you need to change the location of that file for any reason, you can modify
102102
the value defined in **app/Config/Constants.php**.
103103

104+
Priority of Autoloaders
105+
=======================
106+
104107
If the same namespace is defined in both CodeIgniter and Composer, Composer's
105108
autoloader will be the first one to get a chance to locate the file.
106109

107110
.. note:: Prior to v4.5.0, if the same namespace was defined in both CodeIgniter and Composer, CodeIgniter's autoloader was
108111
the first one to get a chance to locate the file.
112+
113+
.. _autoloader-composer-support-improve-performance::
114+
115+
Improve Performance
116+
===================
117+
118+
.. versionadded:: 4.5.0
119+
120+
When you use Composer, you could improve the performance of autoloading with
121+
Composer's classmap dump.
122+
123+
Add your ``App`` namespace in your **composer.json**, and run ``composer dump-autoload``.
124+
125+
.. code-block:: text
126+
127+
{
128+
...
129+
"autoload": {
130+
"psr-4": {
131+
"App\\": "app/",
132+
},
133+
...
134+
},
135+
...
136+
}

0 commit comments

Comments
 (0)