A robots.txt helper for Laravel 5.
Switch branches/tags
Nothing to show
Clone or download
Andrew Ellis
Andrew Ellis Merge pull request #1 from TheoKouzelis/patch-1
Add delete public/robots.txt to README.md
Latest commit 429f055 Jul 6, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src removed double quotes Apr 30, 2015
tests initial commit Apr 30, 2015
.codeclimate.yml added .codeclimate.yml Apr 30, 2015
.gitignore removed double quotes Apr 30, 2015
.travis.yml replaced coverage call Apr 30, 2015
LICENSE Initial commit Apr 30, 2015
README.md Add delete public/robots.txt to README.md Apr 19, 2016
composer.json moved to code climate Apr 30, 2015
phpunit.xml initial commit Apr 30, 2015

README.md

robots.txt Generator for Laravel 5

Current Release Total Downloads Build Status Code Climate Test Coverage

This is a fork of https://github.com/jayhealey/Robots. It appears development has stalled on the original repository.

The purpose of this fork is to introduce Laravel 5 compatibility and PSR-4 and PSR-2 (for Laravel 5.1).

Installation

Step 1: Composer

Add the package to your composer.json:

{
    "require": {
        "ellisthedev/laravel-5-robots": "~0.1.0"
    }
}

Step 2: Configuration

Add the following to your config/app.php in the providers array:

'EllisTheDev\Robots\RobotsServiceProvider',

You can also optionally add the following to the aliases array:

'Robots' => 'EllisTheDev\Robots\RobotsFacade',

Usage

Delete projects default public/robots.txt

Add the following to your routes file:

Route::get('robots.txt', function ()
{
    if (App::environment() == 'production') {
        // If on the live server, serve a nice, welcoming robots.txt.
        Robots::addUserAgent('*');
        Robots::addSitemap('sitemap.xml');
    } else {
        // If you're on any other server, tell everyone to go away.
        Robots::addDisallow('*');
    }

    return Response::make(Robots::generate(), 200, ['Content-Type' => 'text/plain']);
});

Refer to the Robots.php for API usage.

License

MIT