When I run composer install, it will install all my "require" and the "require" of the other package.
My composer.json
{ "name": "my_app", "require": { "some/package": "0.0.0" } }
The "child" dependency
{ "name": "some/package", "require": { "zendframework/zend-mail": "2.4.*@dev", "soundasleep/html2text": "~0.2", "mpdf/mpdf": "6.0.0", "endroid/qrcode": "1.*@dev" } }
I know that it's possible ignore the php extensions, but what about these second require package?
update / u# In order to get the latest versions of the dependencies and to update the composer. lock file, you should use the update command.
As mentioned above, the composer. lock file prevents you from automatically getting the latest versions of your dependencies. To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your composer.
Try clearing Composer's cache by running composer clear-cache . Ensure you're installing vendors straight from your composer. json via rm -rf vendor && composer update -v when troubleshooting, excluding any possible interferences with existing vendor installations or composer. lock entries.
composer update will update our dependencies as they are specified in composer. json . Supposing we have actually installed the 2.0. 1 version of the package, running composer update will cause an upgrade of this package (for example to 2.0.
You can ignore packages to be downloaded with the replace
property of your composer.json: https://getcomposer.org/doc/04-schema.md#replace
That way you tell composer, that you take or took care of that package's content on your own.
This can help you to ignore a package your are sure you do not need, but it is kind of hacky. So be aware some things (like tests) might break. A better approach would be to request a patch from the maintainer of the original package to make the requirements optional (via the suggest
property).
edit:
Example for "disabling" the requirement to zendframework/zend-mail
:
{ "name": "my_app", "require": { "some/package": "0.0.0" }, "replace": { "zendframework/zend-mail": "*" } }
I know that it's possible ignore the php extensions, but what about these second require package?
Yes, you can use --ignore-platform-reqs
to ignore php, hhvm, lib-* and ext-* platform requirements and force the installation, even if the local machine does not fulfill these.
But, i'm not sure were you are heading with your question. What's the use-case for requiring a package without its dependencies in your application? Isn't this the main reason to use Composer?
No, its not possible, unless you are looking for require --no-update
, which disables the automatic update of the dependencies. Please take a look at the CLI options for require and install.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With