I have a Laravel App and I want to install require dependencies but I was wondering how does composer know whether to load dev dependencies or production dependencies?
just got confused by this concept so if somebody could clarify this concept for me than that would be of great help.
The regular require
dependencies are such packages that you will ALWAYS use, meaning that the framework itself (in this case Laravel), your application code and/or other 3rd party code is dependent on such packages. These dependencies are often referred as prod dependencies since you use them in production (because without them, your app wouldn't run)
The require-dev
dependencies are "optional", in the sense that your core application logic would run, but you would not be able to run "development" stuff, such as Unit tests ( phpunit/phpunit
package) and instantiate fake data ( fzaninotto/faker
).
I hope this helps!
When you run composer install --dev
, composer installs all packages including require-dev
. This is the default behaviour, exclusion of the flag would result in the same action.
When you run composer install --no-dev
, composer skips the require-dev
packages.
Also, composer will not install the require-dev
package of a required
package unless you specifically ask it to do so
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.