Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 298
Naing Lin Aung Avatar asked Nov 28 '13 20:11

Naing Lin Aung


People also ask

What is composer dump-autoload in laravel?

Composer dump-autoload 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.

What is composer dump-autoload?

composer dump-autoload. php artisan dump-autoload. It regenerates the list of all the classes that need to be included in the project (autoload_classmap. php). It will 'recompile' loads of files creating the huge bootstrap/compiled.php.

What is laravel autoload?

Auto-Loading allows you to load class files when they are needed without explicitly loading or including them. This gives you ease in running your application by loading those files automatically which are needed every time. Laravel is built to work with Composer.

How do I undo a composer dump-autoload?

Yes, manually removing all files of the autoloader in the vendor/composer/ folder should work. So, all vendor/composer/autoload_*.


2 Answers

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.

like image 148
Antonio Carlos Ribeiro Avatar answered Oct 10 '22 19:10

Antonio Carlos Ribeiro


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

like image 32
Lucas Bustamante Avatar answered Oct 10 '22 20:10

Lucas Bustamante