Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Maintenance

Guilherme Nascimento edited this page Jan 16, 2026 · 12 revisions

Note: This documentation covers Inphinit 1.0. For the 2.1 documentation, visit: https://inphinit.github.io/en/docs/maintenance.html

For active maintenance you can set true in 'maintenance' => on ./system/application/Config/config.php file, example:

'appdata_expires' => 86400,
'development'     => false,
'maintenance'     => true

This will disable the routes and the ready event (see Events)

Using Maintenace class

For facilitate you can create a Route and use Inphinit\Experimental\Maintenance class

The Inphinit\Experimental\Maintenance class is Experimental, but the maintenance mode is not experimental.

Usage:

  • ./system/main.php

    <?php
    
    use Inphinit\Route;
    
    //Navigate to http://localhost/[project_name]/maintenance-on for enable maintenance mode
    Route::set('GET', '/maintenance-on', 'MaintenanceExample:on');
    
    //Navigate to http://localhost/[project_name]/maintenance-off for disable maintenance mode
    Route::set('GET', '/maintenance-off', 'MaintenanceExample:off');
  • ./system/application/Controller/MaintenanceExample.php

    <?php
    namespace Controller;
    
    use Inphinit\App;
    use Inphinit\Experimental\Maintenance;
    
    class MaintenanceExample
    {
        public function on()
        {
            //Disabled Routes and 'ready' event
            Maintenance::down();
    
            return 'Maintenance is ON';
        }
    
        public function off()
        {
            //enable Routes and 'ready' event
            Maintenance::up();
    
            return 'Maintenance is OFF';
        }
    }

For simplicity you can use Closures, put this in your ./system/main.php:

<?php
use Inphinit\Route;
use Inphinit\Experimental\Maintenance;

//Navegue até http://localhost/[project_name]/maintenance-on para habilitar o modo de manutenção
Route::set('GET', '/maintenance-on', function () {

    //Disabled Routes and 'ready' event
    Maintenance::down();

    return 'Maintenance is ON';
});

//Navegue até http://localhost/[project_name]/maintenance-off para desabilitar o modo de manutenção
Route::set('GET', '/maintenance-off', function () {

    //enable Routes and 'ready' event
    Maintenance::up();

    return 'Maintenance is OFF';
});

Clone this wiki locally