I have different versions of files which are stored in separate subfolders inside a main folder. I intend to use subfolder based on a dynamically determined value of $ver
.
Can I create a psr-4 composer namespace for the main folder and then add to it the $ver
for subfolders as needed.
I tried following but its showing errors.
File Structure:
web\
public\index.php
main\
V1\app.php
V2\app.php
V3\app.php
Composer:
"autoload": {
"psr-4": {
"Application\\": "main"
}
}
index.php:
use Application;
$ver = "V2"; // suppose its V2 for now
$app = new "\Application\" . $ver . "\App()";
app.php:
namespace Application;
class App {
}