[英]require and require-dev dependencies of composer Laravel
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? 我有一个Laravel App,我想安装需要依赖项,但是我想知道作曲家如何知道是加载开发依赖项还是生产依赖项?
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. 常规的
require
依赖关系是您将始终使用的此类软件包,这意味着框架本身(在本例中为Laravel),您的应用程序代码和/或其他第三方代码均依赖于此类软件包。 These dependencies are often referred as prod dependencies since you use them in production (because without them, your app wouldn't run) 这些依赖项通常称为prod依赖项,因为您在生产中使用了它们(因为没有它们,您的应用程序将无法运行)
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
). 在您的核心应用程序逻辑可以运行的意义上,
require-dev
依赖项是“可选的”,但您将无法运行“开发”的东西,例如单元测试( phpunit/phpunit
软件包)和实例化伪造的数据( fzaninotto/faker
)。
I hope this helps! 我希望这有帮助!
When you run composer install --dev
, composer installs all packages including require-dev
. 运行
composer install --dev
,composer将安装所有软件包,包括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. 当您运行
composer install --no-dev
,composer会跳过require-dev
软件包。
Also, composer will not install the require-dev
package of a required
package unless you specifically ask it to do so 此外,除非您明确要求,composer不会安装
required
软件包的require-dev
软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.