PHP code example of oihana / php-robots

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

    

oihana / php-robots example snippets


use DI\Container;
use oihana\robots\commands\RobotsCommand;

$container = new Container();
$command = new RobotsCommand
(
    null,        // let kernel resolve the name
    $container,
    [
        'robots' => [
            'path'    => '/var/www/my-website/htdocs',
            'content' => "User-agent: *\nDisallow: /private/"
        ]
    ]
);
bash
composer