Reputation: 1028
My composer.json looks like that:
"autoload": {
"psr-4": {
"NamespaceA\\": "src/NamespaceA",
"NamespaceB\\NamespaceC\\": "src/NamespaceB/NamespaceC",
"NamespaceD\\": "src/NamespaceD",
"Testers\\": "test/Testers",
"NamespaceE\\": "src/NamespaceE",
"NamespaceF\\": "src/NamespaceF",
"NamespaceG\\": "src/NamespaceG",
}
}
The structure of the namespace is identical to the directories structure inside src.
Is there a way to make the autoload section shorter in this case ?
Upvotes: 0
Views: 53
Reputation: 660
Maybe try use global namespace above all concrete namespaces e.g. App
?
So you can use e.g. App\NamespaceA
in your code
"autoload" : {
"psr-4": {
"App\\": "src"
}
}
Upvotes: 1