2017 © Pedro Peláez
 

library roboxt

lib used for parsing a robots.txt file

image

m6web/roboxt

lib used for parsing a robots.txt file

  • Tuesday, December 9, 2014
  • by benjam1
  • Repository
  • 9 Watchers
  • 16 Stars
  • 356 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 7 Forks
  • 5 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Roboxt

Roboxt is a PHP robots.txt file parser., (*1)

Usage


# Create a Parser instance $parser = new \Roboxt\Parser(); # Parse your robots.txt file $file = $parser->parse("http://www.google.com/robots.txt"); # You can verify that an url is allowed by a specific user agent $tests = [ ["/events", "*"], ["/search", "*"], ["/search", "badbot"], ]; foreach ($tests as $test) { list($url, $agent) = $test; if ($file->isUrlAllowedByUserAgent($url, $agent)) { echo "\n ✔ $url is allowed by $agent"; } else { echo "\n ✘ $url is not allowed by $agent"; } } # You can also iterate over all user agents specified by the robots.txt file # And check the type of each directive foreach ($file->allUserAgents() as $userAgent) { echo "\n Agent {$userAgent->getName()}: \n"; foreach ($userAgent->allDirectives() as $directive) { if ($directive->isDisallow()) { echo " ✘ {$directive->getValue()} \n"; } else if ($directive->isAllow()) { echo " ✔ {$directive->getValue()} \n"; } } }

Installation

The recommended way to install Roboxt is through Composer:, (*2)

$> composer require m6web/roboxt

Running the Tests

Roboxt uses PHPSpec for the unit tests:, (*3)

$> composer install --dev

$> ./vendor/bin/phpspec run

Credits

License

Roboxt is released under the MIT License., (*4)

The Versions

09/12 2014

dev-master

9999999-dev

lib used for parsing a robots.txt file

  Sources   Download

MIT

The Requires

 

The Development Requires

08/12 2014

1.1.0

1.1.0.0

lib used for parsing a robots.txt file

  Sources   Download

MIT

The Requires

 

The Development Requires

22/07 2013

1.0.0

1.0.0.0

lib used for parsing a robots.txt file

  Sources   Download

MIT

The Requires

 

The Development Requires