bagsiz / laravel-maintenance
A simple maintenance mode package for Laravel applications
v1.0.5
2025-03-04 20:09 UTC
Requires
- php: ^7.2|^8.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^3.8|^4.0|^5.0|^6.0|^7.0|^8.0
- phpunit/phpunit: ^7.0|^8.0|^9.0
README
A simple and flexible maintenance mode package for Laravel applications.
Installation
You can install the package via composer:
composer require bagsiz/laravel-maintenance
The package will automatically register its service provider and middleware.
Configuration
You can publish the configuration file and views:
php artisan vendor:publish --provider="Bagsiz\Maintenance\MaintenanceServiceProvider" --tag="maintenance"
This will create:
config/maintenance.php
- Configuration fileresources/views/maintenance/maintenance.blade.php
- Default maintenance view
Usage
Using the Facade
use Bagsiz\Maintenance\Facades\Maintenance; // Enable maintenance mode Maintenance::enable(['127.0.0.1'], ['admin/*']); // Disable maintenance mode Maintenance::disable(); // Check if maintenance mode is enabled if (Maintenance::isEnabled()) { // ... } // Get maintenance mode data $data = Maintenance::getData();
Using Artisan Commands
Enable maintenance mode:
php artisan maintenance on --ip=127.0.0.1 --ip=192.168.1.1 --path=admin/* --path=api/*
Disable maintenance mode:
php artisan maintenance off
Customizing the Maintenance View
The package includes a default maintenance view that you can customize. After publishing the views, you can modify resources/views/maintenance/maintenance.blade.php
to match your application's design.
The view includes:
- A maintenance icon
- A title and description
- Maintenance start time
- Contact information (uses
config('app.admin_email')
)
Features
- Enable/disable maintenance mode
- Allow specific IP addresses to access the application during maintenance
- Allow specific paths to be accessible during maintenance
- Command-line interface for easy management
- Configurable through config file
- Customizable maintenance view
- Automatic middleware registration for both web and API routes
- Simple and lightweight
License
The MIT License (MIT). Please see License File for more information.