Useful commands for smooth deployment of Laravel application
Maintenance mode
php artisan down puts your application in maintenance mode.
This command should be used when you are working on the application and you don’t want users to be using it at the same time.
How to get composer dependencies
composer install retrieves all the application dependencies.
The command is used when you pull certain dependencies of modules from your application. It ensures that all modules in your application have their necessary dependencies.
Migrate database
php artisan migrate --force is used to publish schema or create the necessary tables in your database as defined by your schema.
Clean cache
php artisan cache:clear clears all the data cached in the storage (which can be found in /storage/framework/cache/data/). This command helps make sure you see the most recent changes made on your code and not the cached version.
Clear password tokens
php artisan auth:clear-resets is used to remove password tokens that have expired. This should be done while deploying to production.
Cache routes
php artisan route:cache is very important as it makes the application faster since it reduces all your routes registration to one method call. It must run command for deployment.
Cache config
php artisan config:cache:
Caching your config will enhance the loading of config files thereby improving the run time of your application.
Cache views
php artisan view:cache provides a precompiled version of your views, which may be a down side if you are still making changes in your application, since you might not see recent changes made to the views.
Turn on live mode
php artisan up: Similar to php artisan down, this command puts your application back on live mode, making it accessible to users.