Skip to content

adds conditional check on the vendor/autoload.php, adds proper type in the composer.json

VangelisP requested to merge VangelisP/pdfapi:dev-composerFixes into master

@jaapjansma this is a small MR where we deal with 2 things:

  1. We add a proper type for the composer.json, expected type: civicrm-ext.
  2. 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).

Merge request reports

Loading