PHP code example of fusic / maintenance

1. Go to this page and download the library: Download fusic/maintenance library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fusic / maintenance example snippets


// src/Application.php


// Add use
use Maintenance\Middleware\MaintenanceMiddleware;

    public function middleware($middleware)
    {
        $middleware
            // Add Maintenance Plugin
            ->add(MaintenanceMiddleware::class)            
            
            ->add(ErrorHandlerMiddleware::class)
            ->add(AssetMiddleware::class)
            ->add(RoutingMiddleware::class);

        return $middleware;
    }

// src/Application.php
use Maintenance\Middleware\MaintenanceMiddleware;

    public function middleware($middleware)
    {
        $middleware
            ->add(new MaintenanceMiddleware([
                'allowIp' => [
                    '127.0.0.1',
                ],
                'useXForwardedFor' => true,
            ]))
            ->add(ErrorHandlerMiddleware::class)
            ->add(AssetMiddleware::class)
            ->add(RoutingMiddleware::class);
        return $middleware;
    }