I have a library that I am autoloading in my Laravel project and I want to have a fallback for that library.
The reason is that on some systems, the library will be on a different location (depending on the development/production mode)
For e.g. this below is the package being used:
"autoload": {
"psr-4": {
...
"MyCompany\\MyPackage\\": "../../libraries/MyCompany/MyPackage/src/",
...
}
},
If there is a production package in another location, I want to use it as first preference, and if not found then fallback to the above.
Can I do something like this:
"autoload": {
"psr-4": {
...
"MyCompany\\MyPackage\\": "../encrypted/MyCompany/MyPackage/",
"MyCompany\\MyPackage\\": "../../libraries/MyCompany/MyPackage/src/",
...
}
},
The use case is that on production servers, I will not have to keep the source and will be able to make it work with the encoded files.
Someone might think why don't I edit the composer.json
file on server, I can not do that because that file tracked on git.