[英]How to stop PHP Composer autoload require-dev library?
I use PHPUnit for testing and development only, I don't want my app to autoload them in production server, is it possible? 我只使用PHPUnit进行测试和开发,我不希望我的应用程序在生产服务器中自动加载它们,是否可能?
"require-dev": {
"phpunit/phpunit": "4.2.*",
..
I see the file "autoload_classmap.php" contains lines such as.. 我看到文件“autoload_classmap.php”包含诸如..之类的行。
return array(
'File_Iterator' => $vendorDir . '/phpunit/php-file-iterator/File/Iterator.php',
'File_Iterator_Facade' => $vendorDir . '/phpunit/php-file-iterator/File/Iterator/Facade.php',
Updated: 更新:
I want a clean production env and don't want to autoload phpunit, I only need phpunit during development. 我想要一个干净的生产环境,不想自动加载phpunit,我在开发过程中只需要phpunit。 So, can composer generate two autoload.php so I can include them depending on my current env?
那么,作曲家可以生成两个autoload.php,所以我可以根据我当前的环境包含它们吗?
--no-dev
: Skip installing packages listed in require-dev --no-dev
:跳过在require-dev中列出的安装包
composer install --no-dev --optimize-autoloader
You will probably also want to do: --optimize-autoloader
(-o): Convert PSR-0/4 autoloading to classmap to get a faster autoloader. 您可能还想这样做:--
--optimize-autoloader
(-o):将PSR-0/4自动加载转换为classmap以获得更快的自动加载器。 This is recommended especially for production, but can take a bit of time to run so it is currently not done by default. 这建议特别适用于生产,但可能需要一些时间才能运行,因此默认情况下目前尚未完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.