What is the difference between require and require-dev sections in composer.json?

前端 未结 6 506
北海茫月
北海茫月 2020-11-28 20:38

I\'m beginning using composer, I know so little about it and have a little experience with web application development.

I just walk through Nettuts+ Tutorial, so I h

6条回答
  •  悲&欢浪女
    2020-11-28 20:52

    1. According to composer's manual:

      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.

      So running composer install will also download the development dependencies.

    2. The reason is actually quite simple. When contributing to a specific library you may want to run test suites or other develop tools (e.g. symfony). But if you install this library to a project, those development dependencies may not be required: not every project requires a test runner.

提交回复
热议问题