“php artisan dump-autoload”和“composer dump-autoload”有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20274082/
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
What are the Differences Between "php artisan dump-autoload" and "composer dump-autoload"?
提问by Naing Lin Aung
I am pretty new to Laravel 4 and Composer. While I do Laravel 4 tutorials, I couldn't understand the difference between those two commands; php artisan dump-autoloadand composer dump-autoloadWhat's the difference between them?
我对 Laravel 4 和 Composer 很陌生。当我做 Laravel 4 教程时,我无法理解这两个命令之间的区别;php artisan dump-autoload和composer dump-autoload它们之间有什么区别?
采纳答案by Antonio Carlos Ribeiro
Laravel's Autoload is a bit different:
Laravel 的 Autoload 有点不同:
1) It will in fact use Composer for some stuff
1) 它实际上会使用 Composer 来处理一些东西
2) It will call Composer with the optimize flag
2) 它将使用优化标志调用 Composer
3) It will 'recompile' loads of files creating the huge bootstrap/compiled.php
3) 它将“重新编译”大量文件,创建巨大的 bootstrap/compiled.php
4) And also will find all of your Workbench packages and composer dump-autoload them, one by one.
4) 并且还会一一找到您所有的 Workbench 包和 composer dump-autoload 它们。
回答by Lucas Bustamante
php artisan dump-autoloadwas deprecated on Laravel 5, so you need to use composer dump-autoload
php artisan dump-autoload在 Laravel 5 上已弃用,因此您需要使用 composer dump-autoload
回答by rajangupta
composer dump-autoload
作曲家转储自动加载
PATH vendor/composer/autoload_classmap.php
- Composer dump-autoload won't download a thing.
- It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php).
- Ideal for when you have a new class inside your project.
- autoload_classmap.php also includes the providers in config/app.php
- Composer dump-autoload 不会下载任何东西。
- 它只是重新生成需要包含在项目中的所有类的列表 (autoload_classmap.php)。
- 非常适合在项目中有新课程时使用。
- autoload_classmap.php 还包括 config/app.php 中的提供者
php artisan dump-autoload
php artisan 转储自动加载
- It will call Composer with the optimize flag
- It will 'recompile' loads of files creating the huge bootstrap/compiled.php
- 它将使用优化标志调用 Composer
- 它将“重新编译”大量文件,创建巨大的 bootstrap/compiled.php

