File tree 4 files changed +44
-2
lines changed
4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 121
121
*/
122
122
$ config ['enable_hooks ' ] = FALSE ;
123
123
124
-
125
124
/*
126
125
|--------------------------------------------------------------------------
127
126
| Class Extension Prefix
136
135
*/
137
136
$ config ['subclass_prefix ' ] = 'MY_ ' ;
138
137
138
+ /*
139
+ |--------------------------------------------------------------------------
140
+ | Composer auto-loading
141
+ |--------------------------------------------------------------------------
142
+ |
143
+ | Enabling this setting will tell CodeIgniter to look for a Composer
144
+ | package auto-loader script in application/vendor/autoload.php.
145
+ |
146
+ | $config['composer_autoload'] = TRUE;
147
+ |
148
+ | Or if you have your vendor/ directory located somewhere else, you
149
+ | can opt to set a specific path as well:
150
+ |
151
+ | $config['composer_autoload'] = '/path/to/vendor/autoload.php';
152
+ |
153
+ | For more information about Composer, please visit http://getcomposer.org/
154
+ |
155
+ | Note: This will NOT disable or override the CodeIgniter-specific
156
+ | autoloading (application/config/autoload.php)
157
+ */
158
+ $ config ['composer_autoload ' ] = FALSE ;
139
159
140
160
/*
141
161
|--------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -447,6 +447,23 @@ function &get_instance()
447
447
$ params = array_slice ($ URI ->rsegments , 2 );
448
448
}
449
449
450
+ /*
451
+ * ------------------------------------------------------
452
+ * Should we use a Composer autoloader?
453
+ * ------------------------------------------------------
454
+ */
455
+ if (($ composer_autoload = config_item ('composer_autoload ' )) !== FALSE )
456
+ {
457
+ if ($ composer_autoload === TRUE && file_exists (APPPATH .'vendor/autoload.php ' ))
458
+ {
459
+ require_once (APPPATH .'vendor/autoload.php ' );
460
+ }
461
+ elseif (file_exists ($ composer_autoload ))
462
+ {
463
+ require_once ($ composer_autoload );
464
+ }
465
+ }
466
+
450
467
/*
451
468
* ------------------------------------------------------
452
469
* Is there a "pre_controller" hook?
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ Release Date: Not Released
61
61
- Added availability checks where usage of dangerous functions like ``eval() `` and ``exec() `` is required.
62
62
- Added support for changing the file extension of log files using ``$config['log_file_extension'] ``.
63
63
- Added support for turning newline standardization on/off via ``$config['standardize_newlines'] `` and set it to FALSE by default.
64
+ - Added configuration setting ``$config['composer_autoload'] `` to enable loading of a `Composer <https://getcomposer.org/ >`_ auto-loader.
64
65
65
66
- Helpers
66
67
Original file line number Diff line number Diff line change @@ -20,4 +20,8 @@ file and add the item you want loaded to the autoload array. You'll
20
20
find instructions in that file corresponding to each type of item.
21
21
22
22
.. note :: Do not include the file extension (.php) when adding items to
23
- the autoload array.
23
+ the autoload array.
24
+
25
+ Additionally, if you want CodeIgniter to use a `Composer <https://getcomposer.org/ >`_
26
+ auto-loader, just set ``$config['composer_autoload'] `` to ``TRUE `` or
27
+ a custom path in **application/config/config.php **.
You can’t perform that action at this time.
0 commit comments