box-project/box

Disable requirement check for specific extension?

Opened this issue · 2 comments

Hey! I've looked through the issues and skimmed through the source and searched the docs and haven't found a mention of this, but is there any way to disable/suppress the requirement check for a specific extension?

For context to my actual use case (hydephp/cli#5), a downstream dependency in my project requires the fileinfo extension, due to this, the generated Phar also requires that extension. But my code actually works without the extension as I'm not using any of the features that requires the extension. Is there a way I can disable this whilst keeping the other requirement checks that are actually applicable?

is there any way to disable/suppress the requirement check for a specific extension?

There isn't really a way to do so unfortunately. The requirement can either not be shipped or disabled at runtime via the environment variable (BOX_REQUIREMENT_CHECKER=0).

But my code actually works without the extension as I'm not using any of the features that requires the extension

Doesn't that mean that fileinfo should not be really required by this package but rather suggested only?

A workaround maybe though would be to add a provide section to your composer.json (ideally only for the PHAR?).

Thanks for the fast response! I'm going to take a closer look at this tomorrow.

Doesn't that mean that fileinfo should not be really required by this package but rather suggested only?

Unfortunately, this requirement is made in a package that one of the packages I depend on depends on. Users of the original package probably need the requirement, but since I don't use all the features from the package, I personally don't need it. I hope that makes sense. Dependencies with dependencies gets messy.

A workaround maybe though would be to add a provide section to your composer.json (ideally only for the PHAR?).

That could work, I'll try it out and let you know, thanks!