New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

infusionweb/laravel-robots-route

A route for serving a basic robots.txt in Laravel 5.1+, based on configuration settings.
2,229 1
Install
composer require infusionweb/laravel-robots-route
Latest Version:0.1.0
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Apr 13, 2016
Links: GitHub  ·  Packagist
Maintainer: rkeppner

Laravel 5 robots.txt Route

A route for serving a basic robots.txt in Laravel 5.1+, based on configuration settings.

This is a fork of ellisthedev/laravel-5-robots, which was a fork of jayhealey/Robots, which was based on earlier work.

The purpose of this fork is to create a set-it-and-forget-it package that can be installed without much effort. It is therefore highly opinionated and not built for configuration.

When enabled, it allows access to all clients and serves up the sitemap.xml. Otherwise, it operates almost identically to Laravel's default configuration, denying access to all clients.

Installation

Step 1: Composer

Via Composer command line:

$ composer require infusionweb/laravel-robots-route

Or add the package to your composer.json:

{
    "require": {
        "infusionweb/laravel-robots-route": "~0.1.0"
    }
}

Step 2: Remove the existing robots.txt

Laravel ships with a default robots.txt which disallows all clients. It needs to be removed for the configured route to work.

$ rm public/robots.txt

Step 3: Enable the route

Add the service provider to your config/app.php:

'providers' => [
    //
    InfusionWeb\Laravel\Robots\RobotsServiceProvider::class,
];

Publish the package config file:

$ php artisan vendor:publish --provider="InfusionWeb\Laravel\Robots\RobotsServiceProvider"

You may now allow clients via robots.txt by editing the config/robots.php file, opening up the site to search engines:

return [
    'allow' => env('ROBOTS_ALLOW', true),
];

Or simply setting the the ROBOTS_ALLOW environment variable to true, via the Laravel .env file or hosting environment.

ROBOTS_ALLOW=true

Credits

License

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

Related Packages

owenmelbz/laravel-robots-txt

Laravel 5.x helpers for a semi-automated robots.txt and meta tags

1,118 15
sayeed/lumen-route-list

List all registered routes

1,028 4
verschuur/laravel-robotstxt

Set the robots.txt content dynamically based on the Laravel app environment.

481,281 39
heropoo/routing

A simple and fast route. Use tree structure storage, fast matching!

5,668 10
langaner/route-priority

Package to add priority to Laravel 5 routes

4,371 7

Version History

Version Released PHP Laravel License
0.1.0 >=5.5.9 ^5.1 MIT