202

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?

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
Naing Lin Aung
  • 3,373
  • 4
  • 31
  • 48
  • 23
    just to point out though , `php artisan dump-autoload` is not included in L5 – Jimmy Obonyo Abor Mar 24 '16 at 21:07
  • I got this message after running dump-autoload in console Class App\Http\Middleware\AdminRedirectIfAuthenticated located in ./app/Http/Middleware/AdminRedirectifAuthenticated.php does not comply with psr-4 autoloading standard. Skipping. – mchomvu Apr 02 '22 at 09:32

2 Answers2

180

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.

Rakesh kumar Oad
  • 1,332
  • 1
  • 15
  • 24
Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
  • 17
    But you still need to run composer dump-autoload as well as artisan dump-autoload in order to get all autoloads right. Example: After a migrate:make, you need a composer dump-autoload in order to do a migrate:rollback. artisan dump-autoload does not work here. – woens May 22 '14 at 21:40
  • Command "dump-autoload" is not defined. What it means? – Čamo Oct 15 '20 at 08:40
96

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

Lucas Bustamante
  • 15,821
  • 7
  • 92
  • 86