I’m a bit confused because I’m programming a plugin for WordPress by using composer as it’s the real way to go.
So I’ve created a composer file inside my plugin and some other stuff. In the composer file I’ve added my namespace for autoloading:
"autoload": {
"psr-4": {
"Johnny\\Lolkick\\": [
"includes/classes/"
]
}
}
Inside my classes folder I’ve created now a class with the name class-main.php
. I’ve decided to take this name because of the WordPress naming conventions.
The class by itself was named class Main {
. Inside my base plugin file I’ve created now a new instance of my class which failed. After changing the file name to Main.php
it worked.
So in result the WordPress naming convention broke the autoloading of composer. I want to know now how do you handle this problem? How should I keep the naming convention by using composer?