- PHP 8.2 or newer
- CodeIgniter 4.x
codeigniter4/settings^2.2 (installed automatically)
composer require daycry/maintenancemodeComposer's files autoload registers the global maintenance()
helper, so you can call it from anywhere immediately after install.
The package ships sensible defaults, but most users want to publish a local
copy of Config\Maintenance so they can pin secrets and choose a driver:
php spark mm:publishThis creates app/Config/Maintenance.php (and the package's 503 view skeleton
under app/Views/errors/). Edit those files freely — you own them.
php spark mm:statusYou should see something like:
✅ **** Application is LIVE ****
Users can access the application normally.
Storage method: Cache
If you see "MAINTENANCE MODE" instead, run php spark mm:up first to clear any
leftover state.
To make the package actually intercept HTTP requests, add the filter alias and
apply it to whatever routes you want guarded. In app/Config/Filters.php:
public array $aliases = [
// ...
'maintenance' => \Daycry\Maintenance\Filters\Maintenance::class,
];
public array $globals = [
'before' => [
'maintenance', // applies to every request
],
'after' => [],
];If you'd rather guard a subset of routes, use route-level filters in
app/Config/Routes.php instead of $globals.