Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid using php composer dump-autoload with laravel 4?

I have uploaded my project on a web host and I use ftp to edit my code. The problem is that I added models using eloquent for my database and to get it work I have to download my project dans run php composer dump-autoload then re-upload. Otherwise its say class not found ... Doing this all the time is just heavy. Is there any other solution? My webhost does not have ssh or any thing to connect to the server. Neither I can use rsync like stuff. Maybe I should use an other framework than laravel4 to avoid using composer?

like image 722
ElGato Avatar asked Jun 19 '13 08:06

ElGato


People also ask

What is use of 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.

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_*.

What is PHP artisan dump-autoload?

If you need to regenerate your package's autoload files, you may use the php artisan dump-autoload command. This command will regenerate the autoload files for your root project, as well as any workbenches you have created.

How autoload PHP class the composer way?

After you create the composer. json file in your project root with the above contents, you just need to run the composer dump-autoload command to create the necessary autoloader files. These will be created under the vendor directory. Finally, you need to include the require 'vendor/autoload.


2 Answers

In your case, you should add your needed autoload directory to the ClassLoader::addDirectories array under /app/start/global.php. Laravel gives multiple ways to accomplish the same thing depending on your personal needs.

like image 105
CashIsClay Avatar answered Oct 23 '22 03:10

CashIsClay


You can remove or not upload the bootstrap/compiled.php file. I'm not sure if this completely fixes your problem, because I'm not sure if dump-autoload generates multiple files.

[edit]An other approach is to work on your local machine and upload after you are finished.

like image 30
Rob Gordijn Avatar answered Oct 23 '22 02:10

Rob Gordijn