Skip to content

daycry/maintenancemode

Repository files navigation

Donate

Maintenance Mode for Codeigniter 4

Build status Coverage status Downloads GitHub release (latest by date) GitHub stars GitHub license

Installation via composer

Use the package with composer install

composer require daycry/maintenancemode

Configuration

Run command:

php spark mm:publish

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default file will be present in app/Config/Maintenance.php.

Commands Available

php spark mm:down
php spark mm:status
php spark mm:up

Use it

Method 1 (Recommended)

Create new event in app/Config/Events.php

Events::on( 'pre_system', 'Daycry\Maintenance\Controllers\Maintenance::check' );

Method 2

edit application/Config/Filters.php and add the new line in $aliases array:

public $aliases = [
    'maintenance' => \Daycry\Maintenance\Filters\Maintenance::class,
    ...
]

and add "maintenance" in $globals['before'] array:

public $globals = [
    'before' => [
        'maintenance',
        ...
    ],
    'after'  => [
        ...
    ],
];