Maintenance

Learn how to use your application is maintenance mode.

Configuration

You can activate development mode by changing the value of the maintenance key to true in the system/configs/app.php file, for example:

<?php return array( 'data_lifetime' => 86400, 'development' => true, 'fowarded_proto' => null, 'fowarded_host' => null, 'fowarded_port' => null, 'maintenance' => true, );

Activate dynamically

It is possible to activate maintenance mode by calling the Inphinit\Maintenance::down() method. This will change the system/config/app.php file.

You can create a route for active maintenance mode, but it is important to use some security condition, example:

use Inphinit\Debugging\Maintenance; $app->action('GET', '/down', function () { if (<condition>) { Maintenance::down(); return 'Down website for the next requests'; } else { Maintenance::status(403); } });

Deactivate dynamically

It is possible to deactivate maintenance mode by calling the Inphinit\Maintenance::up() method. This will change the system/config/app.php file.

You can create a route for deactive maintenance mode, but it is important to use some security condition, example:

use Inphinit\Debugging\Maintenance; $app->action('GET', '/up', function () { if (<condition>) { Maintenance::up(); return 'Up website for the next requests'; } else { Maintenance::status(403); } });

Bypass maintenance

To ignore maintenance mode even when it is enabled, you can configure the {placeholder} method. For example, if a specific IP needs to test the application, you can configure something like:

Maintenance::bypass(function () { return $_SERVER['REMOTE_ADDR'] === '...'; });
Go to homepage
Star us on Github