Skip to content

PSR-15 middleware to enable/disable the robots of the search engines

License

Notifications You must be signed in to change notification settings

middlewares/robots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8abe4c4 · Feb 8, 2017

History

16 Commits
Feb 8, 2017
Feb 8, 2017
Oct 5, 2016
Oct 5, 2016
Dec 24, 2016
Oct 5, 2016
Feb 8, 2017
Oct 5, 2016
Jan 2, 2017
Feb 8, 2017
Feb 8, 2017
Oct 5, 2016
Oct 5, 2016

Repository files navigation

middlewares/robots

Latest Version on Packagist Software License Build Status Quality Score Total Downloads SensioLabs Insight

Middleware to enable/disable the robots of the search engines for non-production environment. Adds automatically the header X-Robots-Tag in all responses and returns a default body for /robots.txt request.

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/robots.

composer require middlewares/robots

Example

$dispatcher = new Dispatcher([
	new Middlewares\Robots(false)
]);

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

echo $response->getHeaderLine('X-Robots-Tag'); //noindex, nofollow, noarchive

Options

__construct(bool $allow)

Set true to allow search engines and false to disallow.

sitemap(string $sitemap)

Optional url of a sitemap file.


Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

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