LaravelPackages.net
Acme Inc.
Toggle sidebar
djstarcom/laravel-robots-manager

Laravel robots.txt manager

2
0
v2.0.1
About djstarcom/laravel-robots-manager

djstarcom/laravel-robots-manager is a Laravel package for laravel robots.txt manager. It currently has 0 GitHub stars and 2 downloads on Packagist (latest version v2.0.1). Install it with composer require djstarcom/laravel-robots-manager. Discover more Laravel packages by djstarcom or browse all Laravel packages to compare alternatives.

Last updated

Laravel robots.txt manager

Current Release Build Status Code Coverage Code Climate Test Coverage

Installation

First, install the package via composer:

composer require "djstarcom/laravel-robots-manager"

The package will automatically register itself.

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.
        RobotsManager::addUserAgent('*');
        RobotsManager::addSitemap('sitemap.xml');
    } else {
        // If you're on any other server, tell everyone to go away.
        RobotsManager::addDisallow('*');
    }

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

Refer to the RobotsManager.php for API usage.

License

MIT

Star History Chart