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

前端 未结 6 509
北海茫月
北海茫月 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 21:04

    From the composer site (it's clear enough)

    require#

    Lists packages required by this package. The package will not be installed unless those requirements can be met.

    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.

    Using require-dev in Composer you can declare the dependencies you need for development/testing the project but don't need in production. When you upload the project to your production server (using git) require-dev part would be ignored.

    Also check this answer posted by the author and this post as well.

提交回复
热议问题