Wednesday, January 5, 2022

[FIXED] Run composer dump-autoload from controller in laravel 5

Issue

I want to run composer dump-autoload without shell command in controller.
In laravel 4 I use Artisan::call('dump-autoload');
but in laravel 5 this command not work.


Solution

Artisan is not wrapper for composer. Composer itself brings the composer command to control itself.

Currently there is no way to call composer commands in a proper way from Artisan - not even with creating your own Artisan command with php artisan make:console CommandName.

Unless you don't want to use PHPs exec or system, which I highly do not recommend, you better run composer dump-autoload on its own.



Answered By - codedge

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.