vipnytt/robotstxtparser
Composer 安装命令:
composer require vipnytt/robotstxtparser
包简介
Robots.txt parsing library, with full support for every directive and specification.
关键字:
README 文档
README
Robots.txt parser
An easy to use, extensible robots.txt parser library with full support for literally every directive and specification on the Internet.
Usage cases:
- Permission checks
- Fetch crawler rules
- Sitemap discovery
- Host preference
- Dynamic URL parameter discovery
robots.txtrendering
Advantages
(compared to most other robots.txt libraries)
- Automatic
robots.txtdownload. (optional) - Integrated Caching system. (optional)
- Crawl Delay handler.
- Documentation available.
- Support for literally every single directive, from every specification.
- HTTP Status code handler, according to Google's spec.
- Dedicated
User-Agentparser and group determiner library, for maximum accuracy. - Provides additional data like preferred host, dynamic URL parameters, Sitemap locations, etc.
- Protocols supported:
HTTP,HTTPS,FTP,SFTPandFTP/S.
Requirements:
Installation
The recommended way to install the robots.txt parser is through Composer. Add this to your composer.json file:
{
"require": {
"vipnytt/robotstxtparser": "^2.1"
}
}
Then run: php composer update
Getting started
Basic usage example
<?php $client = new vipnytt\RobotsTxtParser\UriClient('http://example.com'); if ($client->userAgent('MyBot')->isAllowed('http://example.com/somepage.html')) { // Access is granted } if ($client->userAgent('MyBot')->isDisallowed('http://example.com/admin')) { // Access is denied }
A small excerpt of basic methods
<?php // Syntax: $baseUri, [$statusCode:int|null], [$robotsTxtContent:string], [$encoding:string], [$byteLimit:int|null] $client = new vipnytt\RobotsTxtParser\TxtClient('http://example.com', 200, $robotsTxtContent); // Permission checks $allowed = $client->userAgent('MyBot')->isAllowed('http://example.com/somepage.html'); // bool $denied = $client->userAgent('MyBot')->isDisallowed('http://example.com/admin'); // bool // Crawl delay rules $crawlDelay = $client->userAgent('MyBot')->crawlDelay()->getValue(); // float | int // Dynamic URL parameters $cleanParam = $client->cleanParam()->export(); // array // Preferred host $host = $client->host()->export(); // string | null $host = $client->host()->getWithUriFallback(); // string $host = $client->host()->isPreferred(); // bool // XML Sitemap locations $host = $client->sitemap()->export(); // array
The above is just a taste the basics, a whole bunch of more advanced and/or specialized methods are available for almost any purpose. Visit the cheat-sheet for the technical details.
Visit the Documentation for more information.
Directives
Specifications
- Google robots.txt specifications
- Yandex robots.txt specifications
- W3C Recommendation HTML 4.01 specification
- Sitemaps.org protocol
- Sean Conner: "An Extended Standard for Robot Exclusion"
- Martijn Koster: "A Method for Web Robots Control"
- Martijn Koster: "A Standard for Robot Exclusion"
- RFC 7231,
2616 - RFC 7230,
2616 - RFC 5322,
2822,822 - RFC 3986,
1808 - RFC 1945
- RFC 1738
- RFC 952
vipnytt/robotstxtparser 适用场景与选型建议
vipnytt/robotstxtparser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 796.55k 次下载、GitHub Stars 达 26, 最近一次更新时间为 2016 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「parser」 「google」 「W3C」 「spider」 「robots.txt」 「robots」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vipnytt/robotstxtparser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vipnytt/robotstxtparser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vipnytt/robotstxtparser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily disable HTML5 validation errors.
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
An MT940 bank statement parser for PHP
Pleasantly work with asynchronous code.
Laravel integration for the jsonapi.org parser
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
统计信息
- 总下载量: 796.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 36
- 依赖项目数: 7
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-08