So here it is src/composer.json
:
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
}
],
"keywords": [
"bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
],
"support": {
"issues": "https://github.com/roots/bedrock/issues",
"forum": "https://discourse.roots.io/category/bedrock"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org",
"only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
}
],
"require": {
"php": ">=7.1",
"composer/installers": "^1.8",
"vlucas/phpdotenv": "^4.1.8",
"oscarotero/env": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/wordpress": "^5.8.0",
"roots/wp-config": "1.0.0",
"roots/wp-password-bcrypt": "1.0.0",
"wpackagist-plugin/duplicate-page": "^4.4",
"wpackagist-plugin/wordpress-importer": "^0.7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5.6",
"roave/security-advisories": "dev-master"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "web/wp"
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"test": [
"phpcs"
]
},
"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"
}
}
}
I think the first should be enough, but I tried also sub folders.
In each of my classes the namespace looks like this:
namespace App\mytheme\includes\utils;
// example for src/app/themes/mytheme/includes/utils/Array_Utils.php
class Array_Utils
{...}