Open In App

Difference Between “php artisan dump-autoload” and “composer dump-autoload”

PHP Artisan: Artisan is a command-line UI that can aid you while you build your application. PHP artisan command performs multiple tasks in less time and is more efficient. It can be used to create a model, to create a cache, to create a controller, and can also be used to create Laravel packages and add dummy data too. PHP artisan serve: This command can be used to run your application. It is used for developing and testing purposes as well.

php artisan serve
php artisan serve --host=hostname.app --port=8080

Usage of PHP artisan command: The important thing you need to know while using Laravel is, running your project through localhost is not possible, it can be run only through the php artisan serve command itself.



php artisan make:model
php artisan cache:clear
php artisan config:clear
php artisan view:clear 
php artisan make:controller TestController

PHP artisan dump-autoload: The php artisan dump-autoload command call the Composer with optimize flag. It will recompile loads of files creating the huge bootstrap/compiled.php PHP Composer The composer is an application-level package manager for PHP Programming language. A composer is a tool for managing the dependencies in PHP. There are several commands which you need to know before using the composer tool.




"autoload":{
    "classmap":["database"],
    "files":["name1.php", "name2.php"]
},

composer remove packageauthor/packagename

Difference Between “PHP artisan dump-autoload” and “PHP composer dump-autoload”: Let us now take a brief look to understand the difference between the composer dump-autoload and PHP artisan dump-autoload commands.



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
It wont’t download any new thing to the project. It will call the composer with optimize flag.
Find all the workbench packages and composer dump-autoload them, one by one. It will use composer for some functions.
This command is supported in all Laravel versions. This command is deprecated in Laravel 5 and above versions.
Article Tags :