PHP code example of jazzman / php-robots

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

    

jazzman / php-robots example snippets


use JazzMan\Robots\Robots;
use JazzMan\Robots\RobotsInterface;

Robots::getInstance()
    ->host("www.site.com")
    ->userAgent("*")
    ->allow("one","two")
    ->disallow("one","two","three")
    ->each(function (RobotsInterface $robots) {
        $robots->userAgent("Google")
            ->comment("Comment Google")
            ->spacer()
            ->allow("testing");
    })->each(function (RobotsInterface $robots) {
        $robots->userAgent("Bind")
            ->comment("Comment Bind")
            ->spacer()
            ->allow("testing");
    })->create(); // or render()


composer 
json
{
    "azzman/php-robots": "2.0"
    }
}