PHP code example of league / stack-robots

1. Go to this page and download the library: Download league/stack-robots 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/ */

    

league / stack-robots example snippets


return new Response("User-Agent: *\nDisallow: /", 200, array('Content-Type' => 'text/plain'));



use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use League\StackRobots\Robots;

$app = new Stack\CallableHttpKernel(function (Request $request) {
    return new Response('Hello World!');
});

putenv('SERVER_ENV=dev');

$app = (new Stack\Builder)
    ->push('League\\StackRobots\\Robots')
    ->resolve($app);

Stack\run($app);