PHPackages                             middlewares/shutdown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. middlewares/shutdown

ActiveLibrary[HTTP &amp; Networking](/categories/http)

middlewares/shutdown
====================

Middleware to display a 503 maintenance page

v2.1.0(1y ago)43.3k11MITPHPPHP ^7.2 || ^8.0CI failing

Since Oct 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/middlewares/shutdown)[ Packagist](https://packagist.org/packages/middlewares/shutdown)[ Docs](https://github.com/middlewares/shutdown)[ RSS](/packages/middlewares-shutdown/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (8)Versions (14)Used By (1)

middlewares/shutdown
====================

[](#middlewaresshutdown)

[![Latest Version on Packagist](https://camo.githubusercontent.com/38f28cdee1d6d6ce0b6a0b54e466bc8da02c6bf455a24295768026cb5bb910dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6964646c6577617265732f73687574646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/middlewares/shutdown)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Testing](https://github.com/middlewares/shutdown/workflows/testing/badge.svg)](https://github.com/middlewares/shutdown/workflows/testing/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/ae7449d5056f2f968da56bb05a128e129be93ae5b7836d72673e273904c89793/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6964646c6577617265732f73687574646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/middlewares/shutdown)

Middleware to display a `503` maintenance page.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2
- A [PSR-7 http library](https://github.com/middlewares/awesome-psr15-middlewares#psr-7-implementations)
- A [PSR-15 middleware dispatcher](https://github.com/middlewares/awesome-psr15-middlewares#dispatcher)

Installation
------------

[](#installation)

This package is installable and autoloadable via Composer as [middlewares/shutdown](https://packagist.org/packages/middlewares/shutdown).

```
composer require middlewares/shutdown
```

Example
-------

[](#example)

```
$dispatcher = new Dispatcher([
	(new Middlewares\Shutdown())->retryAfter(60 * 5)
]);

$response = $dispatcher->dispatch(new ServerRequest());
```

Usage
-----

[](#usage)

This middleware generates a `503` response to display while the server is in maintenance. Optionally, you can provide a `Psr\Http\Message\ResponseFactoryInterface` used to create the responses. If it's not defined, [Middleware\\Utils\\Factory](https://github.com/middlewares/utils#factory) will be used to detect it automatically.

```
$responseFactory = new MyOwnResponseFactory();

$maintenance = new Middlewares\Shutdown($responseFactory);
```

### retryAfter

[](#retryafter)

If known, the length of the downtime in seconds or the estimated date and time when the downtime will be complete. [More info about why this](https://webmasters.googleblog.com/2011/01/how-to-deal-with-planned-site-downtime.html)

```
//Retry after 5 minutes
$maintenance = (new Middlewares\Shutdown())->retryAfter(60 * 5);

//You can use also a DateTimeInterface object
$maintenance = (new Middlewares\Shutdown())->retryAfter(new Datetime('+5 minutes'));
```

### render

[](#render)

Use this option to customize the content of the response by providing a callable that returns a string:

```
//Load a html file
$maintenance = (new Middlewares\Shutdown())->render(function () {
	return file_get_contents('503.html');
});
```

---

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance42

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 91.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~257 days

Recently: every ~605 days

Total

13

Last Release

464d ago

Major Versions

v0.7.0 → v1.0.02018-01-27

v1.1.0 → v2.0.02019-12-04

PHP version history (4 changes)v0.1.0PHP ^5.6 || ^7.0

v0.6.0PHP ^7.0

v2.0.0PHP ^7.2

v2.0.1PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e99df56b617f4af8cf0556a51a0ca20c7420104920c57d7e9eab093f92bb744f?d=identicon)[oscarotero](/maintainers/oscarotero)

![](https://www.gravatar.com/avatar/42e0d72f42eb7d84f67e20d28606da42e5a3248ca908b1eadb4366aafeae2561?d=identicon)[filisko](/maintainers/filisko)

---

Top Contributors

[![oscarotero](https://avatars.githubusercontent.com/u/377873?v=4)](https://github.com/oscarotero "oscarotero (51 commits)")[![filisko](https://avatars.githubusercontent.com/u/8798694?v=4)](https://github.com/filisko "filisko (4 commits)")[![frugan-dev](https://avatars.githubusercontent.com/u/7957714?v=4)](https://github.com/frugan-dev "frugan-dev (1 commits)")

---

Tags

httpmaintenancemiddlewarepsr-15shutdownhttppsr-7middlewarepsr-15maintenanceshutdown

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/middlewares-shutdown/health.svg)

```
[![Health](https://phpackages.com/badges/middlewares-shutdown/health.svg)](https://phpackages.com/packages/middlewares-shutdown)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3913.8M120](/packages/mezzio-mezzio)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

577.0M95](/packages/laminas-laminas-stratigility)[middlewares/request-handler

Middleware to execute request handlers

451.7M28](/packages/middlewares-request-handler)[middlewares/fast-route

Middleware to use FastRoute

95200.5k15](/packages/middlewares-fast-route)[middlewares/negotiation

Middleware to implement content negotiation

46453.0k11](/packages/middlewares-negotiation)[middlewares/trailing-slash

Middleware to normalize the trailing slash of the uri path

32527.5k13](/packages/middlewares-trailing-slash)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
