php composer – What’s the difference between require and require-dev?

The require-dev packages are packages that aren't necessary for your project to work and shouldn't be included in the production version of your project.

Typically, these are packages such as phpunit/phpunit that you would only use during development.

How does composer know the it is in a dev evironment and should use require-dev?
stephen
Dec 25 '15 at 19:41

@surfer190 my understanding is that composer doesn't know; you need to execute composer install or update with the --no-dev option in your live environment to avoid installing the dev packages, but I might be wrong. –
Jose B
Jan 14 '16 at 16:23

**Do you even want composer to know? – **
Cas Bloem
Mar 2 '16 at 10:44

@surfer190 By default, "dev" dependencies are installed for the package where you're running composer install (what composer terms the "root package"), but not for other packages installed as dependencies. –
Nathan Craike
Apr 1 '16 at 4:27

I think the real question here is "Will having packages in require-dev make Composer complain on composer update|require for packages in require? –
Brandon
Dec 8 '16 at 15:35
@JoseB wow thanks, that's what I needed to know 🙂

SOURCE: https://stackoverflow.com/questions/16679589/whats-the-difference-between-require-and-require-dev


Leave a Reply

Your email address will not be published. Required fields are marked *