205

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?

2
  • 23
    just to point out though , php artisan dump-autoload is not included in L5 Commented Mar 24, 2016 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
    Commented Apr 2, 2022 at 9:32

2 Answers 2

182

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.

2
  • 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
    Commented May 22, 2014 at 21:40
  • Command "dump-autoload" is not defined. What it means?
    – Čamo
    Commented Oct 15, 2020 at 8:40
103

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.