Wallogit.com
2017 © Pedro Peláez
WordPress Core Autoloader for Composer.
This is a custom autoloader generator and class map loader Composer plugin for WordPress Core., (*1)
It diverges from the default Composer autoloader setup in the following ways:, (*2)
ABSPATH.In your project's composer.json, add the following lines:, (*3)
{
"require": {
"schlessera/composer-wp-autoload": "^1"
},
"scripts": {
"post-install-cmd": [
"WordPress\\ComposerAutoload\\Generator::dump"
],
"post-update-cmd": [
"WordPress\\ComposerAutoload\\Generator::dump"
],
"post-autoload-dump": [
"WordPress\\ComposerAutoload\\Generator::dump"
]
},
"extra": {
"wordpress-autoloader": {
"class-root": "ABSPATH",
"case-sensitive": true
},
}
}
After the next update/install, you will have a vendor/autoload_wordpress.php file, that you can simply include and use to autoload classes within WordPress Core., (*4)
You can configure the autoloader by providing "extra" keys under the "wordpress-autoloader" root key., (*5)
"class-root" :, (*6)
String value that is used to replace the dirname($vendorDir) string.
The default is "ABSPATH", to make the autoloader use the ABSPATH constant., (*7)
"case-sensitive":, (*8)
Boolean value to configure whether the classmap loader should be case-sensitive or not. The default value is true., (*9)
All feedback / bug reports / pull requests are welcome., (*10)
This code is released under the MIT license., (*11)
For the full copyright and license information, please view the LICENSE file distributed with this source code., (*12)