All Projects → spatie → Laravel Robots Middleware

spatie / Laravel Robots Middleware

Licence: mit
Enable or disable the indexing of your app

Projects that are alternatives of or similar to Laravel Robots Middleware

Laravel Sitemap
Create and generate sitemaps with ease
Stars: ✭ 1,325 (+411.58%)
Mutual labels:  google, laravel, seo
Socialite
Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.
Stars: ✭ 1,026 (+296.14%)
Mutual labels:  google, laravel
Awesome Seo
Google SEO研究及流量变现
Stars: ✭ 942 (+263.71%)
Mutual labels:  google, seo
Laravel Google Ads
Google Ads API for Laravel
Stars: ✭ 56 (-78.38%)
Mutual labels:  google, laravel
Laravel Google Calendar
Manage events on a Google Calendar
Stars: ✭ 787 (+203.86%)
Mutual labels:  google, laravel
Schema Org
A fluent builder Schema.org types and ld+json generator
Stars: ✭ 894 (+245.17%)
Mutual labels:  google, seo
Serp
Google Search SERP Scraper
Stars: ✭ 40 (-84.56%)
Mutual labels:  google, seo
Search Engine Optimization
🔍 A helpful checklist/collection of Search Engine Optimization (SEO) tips and techniques.
Stars: ✭ 1,798 (+594.21%)
Mutual labels:  google, seo
Curatedseotools
Best SEO Tools Stash
Stars: ✭ 128 (-50.58%)
Mutual labels:  google, seo
Laravel Natural Language
This package makes using the Google Natural API in your laravel app a breeze with minimum to no configuration, clean syntax and a consistent package API.
Stars: ✭ 119 (-54.05%)
Mutual labels:  google, laravel
Laravel Google Drive Demo
Laravel & Google Drive Storage - Demo project with Laravel 5.4
Stars: ✭ 299 (+15.44%)
Mutual labels:  google, laravel
Sitemap Generator Cli
Creates an XML-Sitemap by crawling a given site.
Stars: ✭ 214 (-17.37%)
Mutual labels:  google, seo
Sitemap Generator
Easily create XML sitemaps for your website.
Stars: ✭ 273 (+5.41%)
Mutual labels:  google, seo
Google-rank-tracker
SEO: Python script + shell script and cronjob to check ranks on a daily basis
Stars: ✭ 124 (-52.12%)
Mutual labels:  google, seo
Laravel Link Checker
Check all links in a Laravel application
Stars: ✭ 253 (-2.32%)
Mutual labels:  laravel, seo
Laravelmetatags
The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project
Stars: ✭ 226 (-12.74%)
Mutual labels:  laravel, seo
Seotools
SEO Tools for Laravel
Stars: ✭ 2,406 (+828.96%)
Mutual labels:  laravel, seo
Seo Manager
Seo Manager Package for Laravel ( with Localization )
Stars: ✭ 192 (-25.87%)
Mutual labels:  laravel, seo
Laravel Amp
Package that helps you set up AMP (Accelerated Mobile Pages) using Laravel
Stars: ✭ 106 (-59.07%)
Mutual labels:  google, laravel
Google Places Api
This is a PHP wrapper for Google Places API Web Service. And is Laravel Framework friendly.
Stars: ✭ 147 (-43.24%)
Mutual labels:  google, laravel

Enable or disable the indexing of your app

Latest Version on Packagist GitHub Workflow Status Check & fix styling Total Downloads

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

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

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

Support us

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.

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.

Installation

You can install the package via composer:

$ composer require spatie/laravel-robots-middleware

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.

// app/Http/Middleware/MyRobotsMiddleware.php

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.

// 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.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

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.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].