I am developing with Laravel 5.
When you create a project,
php artisan optimize will be run automatically and
vender/compiled.php will be generated.
In this state,
compiled.php is preferentially loaded at boot time, and the contents of the service provider that you added are not loaded.
Therefore, I delete
compile.php after creating the project every time.
The reason I noticed this phenomenon was that I added the event handler setting to
EventServiceProvider , but the handler did not fire and I was addicted to it.
Optimize is an effective way to improve performance, but I think it's needed during deployment and not needed during development.
So I have a question.
- Is there any reason why
compiled.phpis generated after the project is created?
- Is there a workaround that eliminates the need to manually delete
compiled.phpafter each project creation?
- Is there anything wrong with my perception above? Is it a phenomenon that is invited for that?
It was a bug that compiled.php was generated after creating the project.
Improved in Laravle v5.1. Improvements have been made in both project creation via composer and project generation with the Laravel installer.
Please note that the Laravel installer needs to be updated to v1.2.1.
$ composer global update $ laravel -V Laravel Installer version 1.2.1
Also, from v5.1, the output destination of compiled.php has been changed to bootstrap / cache / compile.php.