Installation
composer require mjtheone/simple-maintenance
Publish the config file:
php artisan vendor:publish --provider="MJTheOne\SimpleMaintenance\SimpleMaintenanceServiceProvider" --tag="config"
Enable Maintenance Mode
php artisan maintenance:enable
This creates a maintenance file in storage/framework/maintenance.php.
Disable Maintenance Mode
php artisan maintenance:disable
Check Current Status
php artisan maintenance:status
resources/views/vendor/simple-maintenance/maintenance.blade.php (if the package supports view overrides).Automate with Deploy Scripts Add maintenance mode at the start of your deployment script:
php artisan maintenance:enable
# Run migrations, deploy code, etc.
php artisan maintenance:disable
Conditional Logic in Routes/Middleware Check maintenance status in middleware or route closures:
if (app('maintenance')->isEnabled()) {
abort(503, 'Site under maintenance');
}
Custom Maintenance Pages Override the default view by publishing assets:
php artisan vendor:publish --tag="simple-maintenance-views"
Then edit resources/views/vendor/simple-maintenance/maintenance.blade.php.
Environment-Specific Maintenance Use config to enable/disable per environment:
// config/simple-maintenance.php
'enabled' => env('MAINTENANCE_MODE', false),
File Permissions
Ensure storage/framework/maintenance.php is writable:
chmod -R 775 storage/framework
maintenance:enable fails silently.Caching Issues Clear config cache after enabling/disabling:
php artisan config:clear
No Built-in Whitelisting The package lacks IP whitelisting. Workaround:
if (app('maintenance')->isEnabled() && !in_array(request()->ip(), ['127.0.0.1', '192.168.1.100'])) {
abort(503);
}
No API for Programmatic Control Directly manipulate the file if needed:
file_put_contents(storage_path('framework/maintenance.php'), '<?php return true;');
storage/framework/maintenance.php exists when mode seems stuck.laravel-debugbar) interfere with middleware order.MJTheOne\SimpleMaintenance\Drivers\Driver to use a database or cache driver.maintenance.enabled/maintenance.disabled events (if the package supports them).app/Http/Kernel.php:
protected $middlewareGroups = [
'web' => [
// ...
\MJTheOne\SimpleMaintenance\Http\Middleware\MaintenanceMiddleware::class,
],
];
How can I help you explore Laravel packages today?