"autoload": {
"psr-4": {
"App\\mytheme\\includes\\": "app/themes/mytheme/includes",
"App\\mytheme\\includes\\utils\\": "app/themes/mytheme/includes/utils",
"App\\mytheme\\includes\\types\\": "app/themes/mytheme/includes/types",
"App\\mytheme\\includes\\controllers\\": "app/themes/mytheme/includes/controllers"
}
}
These paths are incorrect. Look at the other paths defined here, i.e.:
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
You’ve also made it more complex than necessary. The following should work:
"autoload": {
"psr-4": {
"App\\mytheme\\includes\\": "web/app/themes/mytheme/includes"
}
}
Also keep in mind that composer needs to generate autoload maps in order for changes to autoloading to work, so always run composer dump-autoload
after you make changes to autoloading.
Finally, why are you loading theme files at the bedrock level? A Sage theme can autoload files with its own composer.json
. If you want whatever is in these files at a higher level than the theme, then that feels like it should be a plugin or composer package, not some weird deep dependency on a theme.