Search code examples
laravelcomposer-phplaravel-artisanlaravel-5.7laravel-envoy

Laravel Artisan & Composer commands on deployment


What Composer and Artisan commands are necessary to run during deployment of a brand new Laravel application? Per Laravel 5.7 documentation, are these the only essential commands?

composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache

Solution

  • Methods are:

    composer install --optimize-autoloader --no-dev
    composer dump-autoload
    

    The others are optional.

    1. Do you cache your configs? If yes, include php artisan config:cache
    2. Do you cache your routes? If yes, include php artisan route:cache
    3. Do you cache your views? If yes, include php artisan view:cache
    4. Do you want to flush your app cache every time you deploy? If yes, include php artisan cache:clear

    Beware that flushing your app cache could have many undesirable effects, especially if you're using your cache system for sessions, queues, etc. as it would clear out everything