Skip to content

Latest commit

 

History

History
68 lines (53 loc) · 1.24 KB

README.md

File metadata and controls

68 lines (53 loc) · 1.24 KB

Maintenance Mode for Codeigniter 4

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'  => [
        ...
    ],
];