Ebextension setting when releasing a Laravel application to Elastic Beanstalk

Aug 31, 2020 PHP Laravel ElasticBeanstalk

When you release Laravel in production, using a config cache or a route cache will make it run more efficiently and improve the response of your application.

When releasing to Elastic Beanstalk, you can add the command at the time of release by putting a .config file in .ebextensions/*.

     command: "php artisan config:cache"
     command: "php artisan route:cache"
     command: "php artisan view:cache"

With the above, cache of config, route and view can be generated after uploading the application. container_commands are executed before restarting the Apache server.