While I'm familiar with the basics of composer.json
and specifying dependencies under the require
key I haven't quite understood the purpose of require-dev
— Composer's documentation states:
require-dev (root-only)
Lists packages required for developing this package, or running tests, etc. The dev requirements of the root package are installed by default. Both install or update support the --no-dev option that prevents dev dependencies from being installed.
In the abstract it makes sense, but I'm having a hard to imagining the situations when I'd need this functionality.
require-dev
in a workflow?require-dev
but not in require
?One common example is phpunit, which you need in development to run your test suite, but generally won't need in production. It could also be build tools or such things. There is no huge harm in putting everything into require though, it just means you have more code installed on your prod machines, and might slow down your builds a bit depending on how you do them.
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