Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/php-middleware/maintenance

Site maintenance SEO PSR-15 middleware
https://github.com/php-middleware/maintenance

maintenance maintenance-mode middleware php psr-15 psr-17 psr-7 seo

Last synced: about 2 months ago
JSON representation

Site maintenance SEO PSR-15 middleware

Awesome Lists containing this project

README

        

# maintenance [![Build Status](https://travis-ci.org/php-middleware/maintenance.svg?branch=master)](https://travis-ci.org/php-middleware/maintenance)
Site maintenance middleware SEO friendly

## How to usage

Create instance of middleware as you want (we use [named constructors](http://verraes.net/2014/06/named-constructors-in-php/)) and add it to middleware runner.

```php
$date = DateTime::createFromFormat('Y-m-d H:i:s', '2025-11-30 11:12:13');

$middleware = MaintenanceMiddleware::createWithRetryAsDateTime($date, $psr17ResponseFactory);

$middlewareRunner->add($middleware);
$middlewareRunner->run();
```

## Features

* Setup 503 status code,
* Supports `Retry-After` header (as seconds or HTTP-date),
* Supports `Redirect` header (redirect page after `Retry-After` time).

More about this SEO practice: [How to deal with planned site downtime](http://googlewebmastercentral.blogspot.com/2011/01/how-to-deal-with-planned-site-downtime.html) in Google Webmaster Central Blog.

## How to install

Use composer!

```bash
composer require php-middleware/maintenance
```

This package require [PSR-17 message factory](https://packagist.org/providers/psr/http-factory-implementation) implementation to return SEO friendly response.