fusic/maintenance

There is no license information available for the latest version (4.0.0) of this package.

Maintenance plugin for CakePHP

Installs: 55 399

Dependents: 0

Suggesters: 0

Security: 0

Stars: 43

Watchers: 8

Forks: 15

Open Issues: 1

Type:cakephp-plugin

4.0.0 2021-03-02 01:42 UTC

This package is auto-updated.

Last update: 2024-10-29 05:04:53 UTC


README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require fusic/maintenance

Usage

// src/Application.php
<?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/Template/Error/maintenance.ctp

<p>maintenance page. </p>
// tmp/maintenance

touch tmp/maintenance

Config

useXForwardedFor

If your system is behind a reverse proxy like load balancer that adds X-Forwarded-For header, set useXForwardedFor as true.

// 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;
    }