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 ?
Maybe try use global namespace above all concrete namespaces eg App
? So you can use eg App\\NamespaceA
in your code
"autoload" : {
"psr-4": {
"App\\": "src"
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.