PHP code example of djstarcom / laravel-robots-manager

1. Go to this page and download the library: Download djstarcom/laravel-robots-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

djstarcom / laravel-robots-manager example snippets


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']);
});