| Package Data | |
|---|---|
| Maintainer Username: | verschuur |
| Maintainer Contact: | govert.verschuur@gmail.com (Govert Verschuur) |
| Package Create Date: | 2016-10-05 |
| Package Last Update: | 2025-02-25 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-20 15:04:09 |
| Package Statistics | |
|---|---|
| Total Downloads: | 357,004 |
| Monthly Downloads: | 7,252 |
| Daily Downloads: | 117 |
| Total Stars: | 39 |
| Total Watchers: | 3 |
| Total Forks: | 15 |
| Total Open Issues: | 0 |
composer require verschuur/laravel-robotstxt
or add the following to your composer.json
{
"require": {
"verschuur/laravel-robotstxt": "^1.0"
}
}
After updating Composer, add the ServiceProvider to the providers array in config/app.php.
Gverschuur\RobotsTxt\RobotsTxtProvider::class
This package adds a route /robots.txt to your application. Remember to remove the physical robots.txt file from your /public dir or else it will take precedence over Laravel's route and this package will not work.
By default, the production environment will show
User-agent: *
Disallow:
while every other environment will show
User-agent: *
Disallow: /
This will allow a basic install to allow all robots on a production install, while disallowing robots on every other environment (such as staging, acceptation etc).
If you need custom settings, publish the configuration file
php artisan vendor:publish --provider="Gverschuur\RobotsTxt\RobotsTxtProvider"
This will copy robots-txt.php to your app's config folder, allowing you fine-grained control over which paths to disallow for which environment and robot. In this file you will find the following array structure
'paths' => [
'production' => [
'*' => [
''
]
]
]
Allow all paths for all robots on production, and disallow everything for every robot in staging
'paths' => [
'production' => [
'*' => [
''
]
],
'staging' => [
'*' => [
'/'
]
]
]
Allow all paths for all robot bender on production, but disallow /admin and /images on production for robot flexo
'paths' => [
'production' => [
'bender' => [
''
],
'flexo' => [
'/admin',
'/images'
]
],
]
This package is compatible with Laravel 5.2 and 5.3.
PHPUnit test cases are provided in /tests. Due to way this package interacts with Laravel, tests should be run from the Laravel root folder
phpunit vendor/verschuur/laravel-robotstxt/tests