Answer the question
In order to leave comments, you need to log in
How to correctly specify autoload for classes without namespace in composer?
- vendor
- author
- package
- path1
- Class2.php (namespace path1;)
- path2
- Class2.php (namespace path2;)
- BaseClass.php (without namespace)
- composer.json <-- autoloader
$baseClass = new BaseClass();
$class2 = new \path1\Class2();
$class2 = new \path2\Class2();
"autoload": {
"classmap": [
"path1",
"path2",
],
"files": [
"BaseClass.php",
]
}
Answer the question
In order to leave comments, you need to log in
But I don’t understand what needs to be written so that the classes are loaded as they are now.Namespaces.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question