This is how you create a composer.json that places itself inside the (managed) vendor directory Very simple, but I didn't find an example while searching, and I want to remind myself that I can do this.
Place this file inside the vendor directory. The following would be an example project structure
+- /project
+- /lib
+- /TestNamespace
- TestClass.php
+- /vendor
- composer.json
- composer.lock
+- /bugsnag
+- /composer
+- /psr
// This is not a valid composer file, because it is not valid JSON due to the comments.
{
// This is the important part
// vendor-dir is the package install path, typically 'vendor'
// Setting it to "." changes the composer package install path relative
// to composer.json, but does NOT change the install structure.
"config": {
"vendor-dir": "."
},
"require": {
"php": ">=5.4",
"bugsnag/bugsnag": "^3.0",
"psr/log": "^1.0",
},
// The other component. The PSR-4 namespace is simply loaded relative to the vendor-dir
"autoload": {
"psr-4": {
"TestNamespace\\": "../lib/TestNamespace"
}
}
}