Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Maintenance

Laravel Maintenance Laravel Package

dginxreal/laravel-maintenance

Laravel package for putting your app into maintenance mode with customizable responses and exclusions. Helps show a friendly maintenance page, allow certain IPs or routes, and quickly toggle maintenance on/off during deployments or upgrades.

View on GitHub
Deep Wiki
Context7

dginxreal/laravel-maintenance is a Laravel package for putting your application into maintenance mode with a clean, configurable user experience. It helps you quickly block access during deployments or outages while still allowing controlled access for specific users or IPs.

Designed to integrate smoothly with Laravel’s middleware and configuration, it provides a simple way to show a custom maintenance page and manage exceptions without hacking core files.

  • Enable/disable maintenance mode via configuration or runtime toggles
  • Customize the maintenance page/view and response behavior
  • Allowlist IPs/users/paths to bypass maintenance
  • Easy Laravel integration via service provider/middleware
  • Supports clean handling for web and API requests
Frequently asked questions about Laravel Maintenance
How do I enable maintenance mode in Laravel using this package?
Use the `php artisan maintenance:enable` command to activate maintenance mode immediately. For runtime control, inject the `MaintenanceMode` facade into your code and call `enable()` or `disable()`. The package also supports toggling via a config flag in `config/maintenance.php`.
Can I customize the maintenance page beyond the default view?
Yes, the package supports Blade templates. Publish the default view with `php artisan vendor:publish --tag=maintenance-views`, then modify the Blade file in `resources/views/vendor/maintenance`. You can also override the response behavior in the middleware configuration.
Does this package work with Laravel 7 or older versions?
The package is designed for Laravel 8+ and may not work out-of-the-box with older versions. Check the `composer.json` constraints or test thoroughly if using Laravel 7 or below, as it relies on newer Laravel features like middleware groups and service container improvements.
How do I allow specific IPs or users to bypass maintenance mode?
Configure the `allowed_ips` and `allowed_users` arrays in `config/maintenance.php`. For dynamic allowlists, extend the middleware by overriding the `isAuthorized()` method in the package’s service provider. The package also supports route-based exclusions via middleware groups.
Will this package interfere with API routes or Sanctum/Passport?
Yes, the package applies maintenance mode to all routes by default, including API routes. To exclude API routes, add the `maintenance-except` middleware to your API route group in `routes/api.php`. For Sanctum/Passport, ensure the allowed IPs include your auth service’s IP.
Is there a way to trigger maintenance mode via a webhook or external API?
The package doesn’t natively support webhook triggers, but you can create a custom route or queue job to call `MaintenanceMode::enable()` when a webhook is received. Alternatively, use Laravel’s task scheduling to toggle maintenance mode at specific times.
How do I test maintenance mode in a CI/CD pipeline?
Manually trigger maintenance mode in your tests using `MaintenanceMode::enable()` before assertions. For integration tests, mock the middleware or use Laravel’s HTTP tests to verify responses (e.g., `assertStatus(503)`). Test both allowed and blocked routes to ensure exclusions work.
What’s the difference between this package and spatie/laravel-maintenance-mode?
This package is lighter and focuses on simplicity, while `spatie/laravel-maintenance-mode` is more feature-rich (e.g., scheduled maintenance, multi-language support). If you need advanced features like analytics or multi-environment setups, Spatie’s package may be better. For basic toggling and custom pages, this package is a leaner choice.
Can I use this package in a multi-environment setup (e.g., staging vs. production)?
Yes, configure environment-specific settings in `config/maintenance.php` using Laravel’s environment variables (e.g., `allowed_ips` for staging vs. production). The package respects Laravel’s `.env` files, so you can toggle maintenance per environment without code changes.
Does this package support custom HTTP status codes or response formats for APIs?
By default, it returns a 503 status for web routes and a custom maintenance page. For APIs, override the middleware’s `handle()` method to return JSON responses (e.g., `response()->json(['error' => 'Service Unavailable'], 503)`). The package’s extensible middleware makes this straightforward.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums