Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel - Generating bootstrap/compiled.php without invoking the composer dump-autoload --optimize

The documented way to generate bootstrap/compiled.php is to run the artisan command: artisan optimize

The problem with artisan optimize is that it runs composer dump-autoload --optimize which flattens out every PSR-0 loading class in composer_classmap.php file. If you are using a library like Zend with PSR-0 autoloading, this classmap file goes beyond 3000 lines. Which is very un-optimal to load on every web request, so I do not want to do that.

How do I simply generate the compiled.php file without populating the composer classmap file?

like image 724
Nands Avatar asked Feb 24 '14 17:02

Nands


1 Answers

Looking at the code, it seems that there is no way to do that. But I changed the code to provide an option and made a pull request: https://github.com/laravel/framework/pull/3708.

EDIT

Pull request merged. Now you can run:

php artisan optimize --psr
like image 167
Antonio Carlos Ribeiro Avatar answered Oct 21 '22 06:10

Antonio Carlos Ribeiro