bakiro / laravel-5-robots
Robots.txt Generator for Laravel 5
Installs: 7 292
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.4.0
- illuminate/support: >=5.0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: ~4.6
This package is auto-updated.
Last update: 2024-04-24 03:36:49 UTC
README
This is a fork of https://github.com/jayhealey/Robots. It appears development has stalled on the original repository.
The purpose of this fork is to introduce Laravel 5 compatibility and PSR-4 and PSR-2 (for Laravel 5.1).
Installation
Step 1: Composer
Add the package to your composer.json
:
{
"require": {
"bakiro/laravel-5-robots": "~0.1.0"
}
}
Step 2: Configuration
Add the following to your config/app.php
in the providers
array:
'Bakiro\Robots\RobotsServiceProvider',
You can also optionally add the following to the aliases
array:
'Robots' => 'Bakiro\Robots\RobotsFacade',
Usage
Add the following to your routes file:
Route::get('robots.txt', function () { if (App::environment() == 'production') { // If on the live server, serve a nice, welcoming robots.txt. Robots::addUserAgent('*'); Robots::addSitemap('sitemap.xml'); } else { // If you're on any other server, tell everyone to go away. Robots::addDisallow('*'); } return Response::make(Robots::generate(), 200, ['Content-Type' => 'text/plain']); });
Refer to the Robots.php for API usage.