adds conditional check on the vendor/autoload.php, adds proper type in the composer.json
@jaapjansma this is a small MR where we deal with 2 things:
- We add a proper
type
for thecomposer.json
, expected type:civicrm-ext
. - We add a conditional check to see if
/vendor/autoload.php
actually exists.
Regarding point 2, there are situations where if we compile a bundle/platform with the extension in-place (adding the extension as a requirement into a main composer.json
file), the required 3rd party libraries (in our case: iio/libmergepdf
) will be automatically processed and downloaded by composer but they will not be added into the extension's vendor
folder.
In such situations, the class calls/references work perfectly, however, the require_once(E::path(). '/vendor/autoload.php');
would certainly fail to load the missing file.
Adding a conditional check, minimises that possibility and still maintains compatibility with both situations (libraries existing either in the extension's vendor
folder or in the platform's vendor
folder).