codeigniterext/maintenancemode

Maintenance Mode module for CodeIgniter 4

0.0.2 2022-12-24 02:42 UTC

This package is auto-updated.

Last update: 2024-05-24 06:11:05 UTC


README

Maintenance mode module for CodeIgniter 4 with CLI

Installing

$ composer require codeigniterext/maintenancemode

or

$ composer require codeigniterext/maintenancemode:dev-master

Now you can use the following commands from the command prompt

$ php spark mm:publish
$ php spark mm:down
$ php spark mm:status
$ php spark mm:up

Configuration

Run the following command from the command prompt, and it will copy views (error_503.php) into your application

$ php spark mm:publish

Use it

Method 1 (Recommended)

edit application/Config/Events.php and add the new line top of the code for maintenance mode check:

Events::on('post_controller_constructor', 'CodeigniterExt\MaintenanceMode\Controllers\MaintenanceMode::check');
...

Method 2

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

public $aliases = [
    'maintenancemode' => \CodeigniterExt\MaintenanceMode\Filters\MaintenanceMode::class,
    ...
]

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

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