“ PHP Artisan Dump-Autoload ”之间有什么区别?和"作曲家转储-自动加载"?

我对Laravel 4和作曲家很陌生。当我做Laravel 4教程时,我无法理解这两个命令之间的区别。php artisan dump-autoloadcomposer dump-autoload它们之间有什么区别?

276067 次浏览

Laravel's Autoload is a bit different:

  1. It will in fact use Composer for some stuff

  2. It will call Composer with the optimize flag

  3. It will 'recompile' loads of files creating the huge bootstrap/compiled.php

  4. And also will find all of your Workbench packages and composer dump-autoload them, one by one.

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

php artisan dump-autoload

  • It will call Composer with the optimize flag
  • It will 'recompile' loads of files creating the huge bootstrap/compiled.php

php artisan dump-autoload was deprecated on Laravel 5, so you need to use composer dump-autoload