PHP code example of spiral-packages / maintenance

1. Go to this page and download the library: Download spiral-packages/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/ */

    

spiral-packages / maintenance example snippets


protected const LOAD = [
    // ...
    \Spiral\Maintenance\Bootloader\MaintenanceBootloader::class,
];

final class RoutesBootloader extends BaseRoutesBootloader
{
    protected function globalMiddleware(): array
    {
        return [
            \Spiral\Maintenance\Middleware\PreventRequestInMaintenanceModeMiddleware::class,
            // ...
        ];
    }
}

<extends:layout.base title="[[Maintenance mode]]"/>
<use:element path="embed/links" as="homepage:links"/>

<stack:push name="styles">
    <link rel="stylesheet" href="/styles/welcome.css"/>
</stack:push>

<define:body>
    <div class="wrapper">
        <img src="/images/503.svg" alt="Error 503" width="300px"/>
        <h2>{{ $exception->getMessage() ?? 'Maintenance mode' }}</h2>
    </div>
</define:body>
bash
php app.php down
bash
php app.php down --status=504
bash
php app.php up