Download the PHP package tomverran/robots-txt-checker without Composer
On this page you can find all versions of the php package tomverran/robots-txt-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tomverran/robots-txt-checker
More information about tomverran/robots-txt-checker
Files in tomverran/robots-txt-checker
Package robots-txt-checker
Short Description Given a robots.txt file, user agent and URL path will tell you whether you're allowed to access a page
License MIT
Homepage https://carefulcoder.co.uk
Informations about the package robots-txt-checker
Robots.txt checker
Given a robots.txt file this library will give you a straight forward yes/no as to whether you're allowed to access a given resource with a given user agent.
This library has been built with reference to both Google's robots.txt specification and the draft norobots RFC from 1996(!). As such all the following features are supported:
- Wildcards in paths, including across directory boundaries
- The '$' suffix to anchor a path match to the end of a URL
- Sorting of multiple matching user-agent/path blocks by user-agent length
- Decoding of URL encoded paths, with the exception of forward slashes
- A trailing slash on a path indicating that all files under that directory should match
If you find any bugs with this library please don't hesitate to let me know, either create an issue on GitHub or submit a pull request.
Installation
Either type the following into your terminal:
or add the following to your composer.json:
Example Usage
I personally use this library alongside an http client library such that all requests go through a class that checks the site's robots.txt first. Basic usage is as follows:
License
tl;dr MIT license
Copyright (c) 2014, 2018 Tom Verran
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.