2017 © Pedro Peláez
 

library laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

image

spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

  • Monday, October 16, 2017
  • by Spatie
  • Repository
  • 5 Watchers
  • 158 Stars
  • 50,406 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 4 Versions
  • 13 % Grown

The README.md

Enable or disable the indexing of your app

Latest Version on Packagist run-tests Check & fix styling Total Downloads, (*1)

A tiny, opinionated package to enable or disable indexing your site via a middleware in Laravel., (*2)

More on the Robots meta tag: https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag, (*3)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*4)

Support us

, (*5)

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products., (*6)

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall., (*7)

Installation

You can install the package via composer: ``` bash $ composer require spatie/laravel-robots-middleware, (*8)


## Usage By default, the middleware enables indexing on all pages. You'll probably want to inherit your own class containing you application's indexing rule handler. ```php // app/Http/Middleware/MyRobotsMiddleware.php namespace App\Http\Middleware; use Illuminate\Http\Request; use Spatie\RobotsMiddleware\RobotsMiddleware; class MyRobotsMiddleware extends RobotsMiddleware { /** * @return string|bool */ protected function shouldIndex(Request $request) { return $request->segment(1) !== 'admin'; } }

Next, simply register the newly created class in your middleware stack., (*9)

// app/Http/Kernel.php

class Kernel extends HttpKernel
{
    protected $middleware = [
        // ...
        \App\Http\Middleware\MyRobotsMiddleware::class,
    ];

    // ...
}

That's it! Responses will now always have an x-robots-tag in their headers, containing an all or none value., (*10)

Changelog

Please see CHANGELOG for more information what has changed recently., (*11)

Testing

bash $ composer test, (*12)

Contributing

Please see CONTRIBUTING for details. Due to nature of this package, there's a fair chance features won't be accepted to keep it light and opinionated., (*13)

Security

If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker., (*14)

Credits

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

16/10 2017

dev-master

9999999-dev https://github.com/spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

seo index spatie robots

12/01 2016

1.0.3

1.0.3.0 https://github.com/spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

seo index spatie robots

05/01 2016

1.0.2

1.0.2.0 https://github.com/spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

seo index spatie robots

05/01 2016

1.0.0

1.0.0.0 https://github.com/spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

seo index spatie robots