library robots-txt
Robots.txt parser
innmind/robots-txt
Robots.txt parser
- Monday, October 2, 2017
- by Baptouuuu
- Repository
- 1 Watchers
- 0 Stars
- 156 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 11 % Grown
Robots.txt
, (*1)
Robots.txt parser, (*2)
Installation
composer require innmind/robots-txt
Usage
use Innmind\RobotsTxt\Parser;
use Innmind\OperatingSystem\Factory;
use Innmind\Url\Url;
$os = Factory::build();
$parse = Parser::of(
$os->remote()->http(),
'My user agent',
);
$robots = $parse(Url::of('https://github.com/robots.txt'))->match(
static fn($robots) => $robots,
static fn() => throw new \RuntimeException('robots.txt not found'),
);
$robots->disallows('My user agent', Url::of('/humans.txt')); //false
$robots->disallows('My user agent', Url::of('/any/other/url')); //true
[!NOTE]
Here only the path /humans.txt is allowed because by default github disallows any user agent to crawl there website except for this file., (*3)
dev-master
9999999-dev
Robots.txt parser
Sources
Download
MIT
The Requires
The Development Requires
3.0.0
3.0.0.0
Robots.txt parser
Sources
Download
MIT
The Requires
The Development Requires
dev-develop
dev-develop
Robots.txt parser
Sources
Download
MIT
The Requires
The Development Requires
2.0.0
2.0.0.0
Robots.txt parser
Sources
Download
MIT
The Requires
The Development Requires
1.0.0
1.0.0.0
Robots.txt parser
Sources
Download
MIT
The Requires
The Development Requires