What is the difference between "require" and "require-dev"?

4

In Composer , Grunt for example, it has require and require-dev . My question is what's the difference between them?

Example phpBB

"require": {
    "php": ">=5.3.3,<7.0",
    "lusitanian/oauth": "0.2.*",
    "symfony/config": "2.3.*",
    "symfony/console": "2.3.*",
    "symfony/dependency-injection": "2.3.*",
    "symfony/event-dispatcher": "2.3.*",
    "symfony/http-kernel": "2.3.*",
    "symfony/routing": "2.3.*",
    "symfony/yaml": "2.3.*",
    "twig/twig": "1.*"
},
"require-dev": {
    "fabpot/goutte": "1.0.*",
    "phing/phing": "2.4.*",
    "phpunit/dbunit": "1.3.*",
    "phpunit/phpunit": "4.1.*",
    "sami/sami": "1.*",
    "squizlabs/php_codesniffer": "2.*",
    "symfony/browser-kit": "2.3.*",
    "symfony/css-selector": "2.3.*",
    "symfony/debug": "2.3.*",
    "symfony/dom-crawler": "2.3.*",
    "symfony/filesystem": "2.3.*",
    "symfony/finder": "2.3.*",
    "symfony/http-foundation": "2.3.*",
    "symfony/process": "2.3.*"
}
    
asked by anonymous 23.05.2016 / 17:11

2 answers

2

The package list in the require key contains the packages that are essential for your project, which must be installed in any of the environments (production, ratification, tests, etc.) in which it will run. The composer install command installs these packages.

The package list in the require-dev key only contains the packages that must be installed in the development environment, and are installed using the composer install --dev command. You should avoid installing these packages in the production environment since, since they should never be used in this type of environment, they end up adding unnecessary files to the project.

    
23.05.2016 / 17:50
1

Keeping this in mind . require-dev packages are not required for your project to work and should not be included in the version that goes into production. These packages by convention are for development and testing only.

    
23.05.2016 / 17:18