thomaswardiii/slim-maintenance-middleware

Maintenance middleware for the Slim 3 framework

Installs: 38

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

pkg:composer/thomaswardiii/slim-maintenance-middleware

v1.1 2015-10-03 14:27 UTC

This package is not auto-updated.

Last update: 2025-10-02 16:04:49 UTC


README

This repository contains an optional middleware for your Slim 3 Framework application.

The middleware will return a default maitenance page with a 503 status code when the application is in maintenance mode.

How to install

Update your composer.json manifest to require the thomaswardiii/slim-maintenance-middleware package (see below). Run composer install or composer update to update your local vendor folder.

{
    "require": {
        "thomaswardiii/slim-maintenance-middleware": "*"
    }
}

How to use

Add the maintenance middleware to your Slim 3 applicaiton:

<?php
$app->add(new \Twardiii\Middleware\Maintenance());

You can also pass a callable function that will be called when maintenance mode is enabled:

<?php
$app->add(new \Twardiii\Middleware\Maintenance(function($request, &response) {
    ...
}));

To enable the maintenance mode just set the $_ENV variable:

<?php
$_ENV['SLIM_MODE'] = 'maintenance';

License

All code in this repository is released under the MIT public license.

http://opensource.org/licenses/MIT