Maintenance mode lets you temporarily stop your Laravel app from being used while you fix or update it. This keeps users from seeing errors or broken pages.
0
0
Maintenance mode in Laravel
Introduction
When you need to update your website without users seeing incomplete changes.
When fixing bugs that might break the app if users keep using it.
When doing database migrations that require the app to be offline.
When performing server or app maintenance that needs exclusive access.
When preparing a big feature release and want to avoid user confusion.
Syntax
Laravel
php artisan down php artisan up
php artisan down puts the app into maintenance mode.
php artisan up brings the app back online.
Examples
This command activates maintenance mode immediately.
Laravel
php artisan down
This command disables maintenance mode and makes the app available again.
Laravel
php artisan up
Sample Program
This example shows the basic commands to toggle maintenance mode in Laravel. When in maintenance mode, users see a default 503 page. You can customize that page to show a friendly message.
Laravel
<?php // To put the Laravel app into maintenance mode // Run this in your terminal: // php artisan down // Now, users see a maintenance page when visiting your app. // To bring the app back online: // php artisan up // You can also customize the maintenance page by editing resources/views/errors/503.blade.php
OutputSuccess
Important Notes
Maintenance mode returns a 503 "Service Unavailable" response for all web requests.
You can customize the maintenance page by editing resources/views/errors/503.blade.php.
Remember to run php artisan up to bring your app back online after maintenance.
Summary
Maintenance mode temporarily stops user access to your Laravel app.
Use php artisan down to enable and php artisan up to disable it.
You can customize the maintenance page and allow special access during maintenance.