December 7, 2016 —John Koster
The optimize
command optimizes various aspects to improve the performance of the Laravel application. The command provides two flags. The --force
flag can be set to indicate that the compiled class file should be written (by default the compiled class is not written when the application is in debug mode). The --psr
flag can be set to indicate that Composer should not create an optimized class map loader (class maps are generally better for performance reasons).
The compiled files cache will be written to the bootstrap/cache/compiled.php
cache file. The files that are compiled and written to the cache any files that meet the following criteria:
compile.files
configuration entry;compile.providers
configuration entry;src/Illuminate/Foundation/Console/Optimize/config.php
file.The following examples demonstrate how to use the optimize
command:
1# Generate a compiled class file with default options.2php artisan optimize3 4# Generate a compiled class file without optimizing the Composer5# autoload file.6php artisan optimize --psr7 8# Generate a compiled class file on a development or debug machine.9php artisan optimize --force
When specifying the --psr
flag, the optimize
command will call the composer dump-autoload
command. Without the --psr
flag, the Composer command composer dump-autoload -o
will be called instead.
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.