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
First, install the package via composer:
composer require "djstarcom/laravel-robots-manager"
The package will automatically register itself.
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.