2017 © Pedro Peláez
 

library robots

Middleware to enable/disable the robots of the search engines

image

middlewares/robots

Middleware to enable/disable the robots of the search engines

  • Thursday, January 25, 2018
  • by oscarotero
  • Repository
  • 2 Watchers
  • 1 Stars
  • 841 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 20 % Grown

The README.md

middlewares/robots

Latest Version on Packagist ![Software License][ico-license] Testing ![Total Downloads][ico-downloads], (*1)

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., (*2)

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/robots., (*3)

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

Usage

The constructor's first argument configure whether block or not search engines., (*4)

//Disallow search engine robots
$robots = new Middlewares\Robots(false);

//Allow search engine robots
$robots = new Middlewares\Robots(true);

Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface as the second argument to create the response of the requests to /robots.txt. If it's not defined, Middleware\Utils\Factory will be used to detect it automatically., (*5)

$responseFactory = new MyOwnResponseFactory();

$robots = new Middlewares\Robots(false, $responseFactory);

sitemap

If your site has a sitemap, use this option to add the url to robots.txt responses., (*6)

$robots = (new Middlewares\Robots(true))->sitemap('/sitemap.xml');

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details., (*7)

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

The Versions

25/01 2018

dev-master

9999999-dev https://github.com/middlewares/robots

Middleware to enable/disable the robots of the search engines

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

25/01 2018

v1.0.0

1.0.0.0 https://github.com/middlewares/robots

Middleware to enable/disable the robots of the search engines

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

13/11 2017

v0.6.0

0.6.0.0 https://github.com/middlewares/robots

Middleware to enable/disable the robots of the search engines

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

21/09 2017

v0.5.0

0.5.0.0 https://github.com/middlewares/robots

Middleware to enable/disable the robots of the search engines

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

08/02 2017

v0.4.0

0.4.0.0 https://github.com/middlewares/robots

Middleware to enable/disable the robots of the search engines

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

26/12 2016

v0.3.0

0.3.0.0 https://github.com/middlewares/robots

Middleware to disable the robots of the search engines for non-production environment

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

27/11 2016

v0.2.0

0.2.0.0 https://github.com/middlewares/robots

Middleware to disable the robots of the search engines for non-production environment

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15

05/10 2016

v0.1.0

0.1.0.0 https://github.com/middlewares/robots

Middleware to disable the robots of the search engines for non-production environment

  Sources   Download

MIT

The Requires

 

The Development Requires

middleware psr-7 http seo robots psr-15