Laravel - 在不调用 composer dump-autoload --optimize 的情况下生成 bootstrap/compiled.php
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21994396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel - Generating bootstrap/compiled.php without invoking the composer dump-autoload --optimize
提问by Nands
The documented way to generate bootstrap/compiled.php is to run the artisan command: artisan optimize
生成 bootstrap/compiled.php 的文档化方法是运行 artisan 命令: artisan optimize
The problem with artisan optimize is that it runs composer dump-autoload --optimize which flattens out every PSR-0 loading class in composer_classmap.php file. If you are using a library like Zend with PSR-0 autoloading, this classmap file goes beyond 3000 lines. Which is very un-optimal to load on every web request, so I do not want to do that.
artisan optimize 的问题在于它运行 composer dump-autoload --optimize 将 composer_classmap.php 文件中的每个 PSR-0 加载类展平。如果您使用像 Zend 这样的库和 PSR-0 自动加载,这个类映射文件超过 3000 行。这对于在每个 Web 请求上加载非常不理想,所以我不想这样做。
How do I simply generate the compiled.php file without populating the composer classmap file?
我如何简单地生成compiled.php 文件而不填充composer classmap 文件?
回答by Antonio Carlos Ribeiro
Looking at the code, it seems that there is no way to do that. But I changed the code to provide an option and made a pull request: https://github.com/laravel/framework/pull/3708.
看代码,好像没有办法。但我更改了代码以提供一个选项并提出拉取请求:https: //github.com/laravel/framework/pull/3708。
EDIT
编辑
Pull request merged. Now you can run:
合并拉取请求。现在你可以运行:
php artisan optimize --psr