Download the PHP package oihana/php-robots without Composer
On this page you can find all versions of the php package oihana/php-robots. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oihana/php-robots
More information about oihana/php-robots
Files in oihana/php-robots
Package php-robots
Short Description The Oihana PHP Robots library
License MPL-2.0
Homepage https://github.com/BcommeBois/oihana-php-robots
Informations about the package php-robots
Oihana PHP - Robots

A PHP library to create and manage robots.txt files, built on top of the oihana-php-commands library.
✨ Features
- Create or remove a project's robots.txt from the CLI
- Optional custom path via -f|--file (absolute or relative)
- Clear console support via -c|--clear
- Config-driven defaults (config.toml)
A robots.txt file is a simple text file placed on a website’s root directory to give instructions to web crawlers (like search engine bots) about which pages or sections of the site should or shouldn’t be crawled and indexed. It helps control search engine access and manage site visibility.
📦 Installation
Requires PHP 8.4+
Install via Composer:
🚀 Usage
The package provides a Symfony Console command named command:robots with actions:
- create: Generate a
robots.txtfile - remove: Delete a
robots.txtfile
Examples:
Create a robots.txt using defaults
Create a robots.txt at a custom path
or
Remove the default robots.txt
Remove a robots.txt at a custom path
Clear the console before running
Options
| Option | ShortCut | Description |
|---|---|---|
| --clear | -c | Clear the console before running |
| --path | -p | The directory path of the 'robots.txt' file |
Notes:
- If
--pathis a relative path, it is resolved against the current working directory. - On creation/removal, parent directory existence and permissions are validated.
⚙️ Configuration
You can set defaults in config/config.toml under the [robots] section:
🧪 Programmatic usage
You can instantiate and configure the command in PHP if needed:
🔚 Exit codes
- 0 Success
- 1 Failure (invalid action, IO failure, etc.)
❓ Troubleshooting
- Ensure the parent directory for the
robots.txtis writable (especially when using a custom--pathoption). - When using relative paths with
--path, they are resolved from the current working directory (pwd). - For more details, see the inline documentation in RobotsCommand.php.
✅ Running Unit Tests
To run all tests:
🧾 License
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).
👤 About the author
- Author: Marc ALCARAZ (aka eKameleon)
- Mail: [email protected]
- Website: http://www.ooop.fr
All versions of php-robots with dependencies
oihana/php-core Version dev-main
oihana/php-system Version dev-main
oihana/php-files Version dev-main
oihana/php-schema Version dev-main
oihana/php-standards Version dev-main
oihana/php-commands Version dev-main