What are the Differences Between "php artisan dump-autoload" and "composer dump-autoload"?

PhpLaravelLaravel 4Laravel Artisan

Php Problem Overview


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-autoload and composer dump-autoload What's the difference between them?

Php Solutions


Solution 1 - Php

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.

Solution 2 - Php

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

Solution 3 - Php

> 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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaing Lin AungView Question on Stackoverflow
Solution 1 - PhpAntonio Carlos RibeiroView Answer on Stackoverflow
Solution 2 - PhpLucas BustamanteView Answer on Stackoverflow
Solution 3 - PhprajanguptaView Answer on Stackoverflow