I have a project with all the composer.json, phpunit.xml, etc in the project's root directory.
All the .php sources are in src/
I have configured composer.json as follows:
{
"name" : "myproj",
"config" : {
"vendor-dir" : "src/vendor"
},
"autoload" : {
"psr-4" : {
"myclasses\\" : "src/classes"
}
}
}
This works beautifully on my dev machine.
The issue is that I only want to deploy the contents of the src directory so that I do not get all the project metadata on the deployment server.
Unfortunately the autoloader looks for the classes in /var/www/test/vendor/composer/../../../src/classes/ instead of e.g. /var/www/test/vendor/composer/../../classes/
PHP Warning: include(): Failed opening '/var/www/test/vendor/composer/../../../src/classes/myclasses/core/messages/MessageList.php' for inclusion (include_path='.:/usr/share/php') in /var/www/test/vendor/composer/ClassLoader.php on line 444
Is there a clever configuration I can make? Or am I forced to move composer.json (which I see as meta-data not needed for production) into /src?
/var/www/test/src/classesyou wouldn't want/var/www/test/classes- Lawrence Cheronesrcis in/var/www/testI want the autoloader to skip the/../srcpart - JoSStesrc/then runcomposer du, but obviously it then won't work locally when you have src - Lawrence Cheronecomposer installandcomposer -o dumpautoloaderon my jenkins server and then scp it to the target server, which does not have composer, etc. ofc I could always keepcomposer.jsonin the deployment dir and then delete it so it's not on the destination server - JoSSte