2017 © Pedro Peláez
 

library robots-txt

Robots.txt Generator

image

cybercog/robots-txt

Robots.txt Generator

  • Saturday, September 9, 2017
  • by a-komarev
  • Repository
  • 2 Watchers
  • 0 Stars
  • 170 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 68 % Grown

The README.md

Robots.txt Generator

Build Status StyleCI Total Downloads Latest Stable Version License, (*1)

RobotsTxt is a package to dynamically create robots.txt files. It's made to work with Laravel and native PHP., (*2)

Checkout the RobotsTxt.php class for a full understanding of the functionality., (*3)

This is fork of Robots package, (*4)

Installation

Downloading

As usual with Composer packages, there are two ways to install:, (*5)

You can install via Composer. Pick the "master" as the version of the package., (*6)

composer require cybercog/robots-txt

Or add the following to your composer.json in the require section and then run composer update to install it., (*7)

{
    "require": {
        "cybercog/robots-txt": "^1.0"
    }
}

Usage

Laravel

Once installed via Composer you need to add the service provider. Do this by adding the following to the 'providers' section of the application config (usually app/config/app.php):, (*8)

Cog\RobotsTxt\Providers\RobotsTxtServiceProvider::class,

The quickest way to use Robots is to just setup a callback-style route for robots.txt in your /app/routes.php file., (*9)

<?php

Route::get('robots.txt', function() {

    // If on the live server, serve a nice, welcoming robots.txt.
    if (App::environment() == 'production')
    {
        RobotsTxt::addUserAgent('*');
        RobotsTxt::addSitemap('sitemap.xml');
    } else {
        // If you're on any other server, tell everyone to go away.
        RobotsTxt::addDisallow('*');
    }

    return Response::make(RobotsTxt::generate(), 200, array('Content-Type' => 'text/plain'));
});

Native PHP

Add a rule in your .htaccess for robots.txt that points to a new script/template/controller/route/etc., (*10)

The code would look something like:, (*11)

<?php
use Cog\RobotsTxt\RobotsTxt;

$robotsTxt = new RobotsTxt();
$robotsTxt->addUserAgent('*');
$robotsTxt->addSitemap('sitemap.xml');

header("HTTP/1.1 200 OK");
echo $robotsTxt->generate();

And that's it! You can show different robots.txt files depending on how simple or complicated you want it to be., (*12)

Contributing

Please refer to CONTRIBUTING.md for information on how to contribute to RobotsTxt and its related projects., (*13)

License

The RobotsTxt library is an open-sourced software licensed under the MIT., (*14)

The Versions

09/09 2017

dev-master

9999999-dev

Robots.txt Generator

  Sources   Download

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

generator seo robots robots.txt

04/07 2016

v1.2.1

1.2.1.0

Robots.txt Generator

  Sources   Download

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

generator seo robots robots.txt

04/07 2016

v1.2.0

1.2.0.0

Robots.txt Generator

  Sources   Download

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

generator seo robots robots.txt

04/07 2016

v1.1.0

1.1.0.0

Robots.txt Generator

  Sources   Download

The Requires

 

The Development Requires

generator seo robots robots.txt

04/07 2016

v1.0.1

1.0.1.0

Robots.txt Generator

  Sources   Download

The Requires

 

The Development Requires

generator seo robots robots.txt

04/07 2016

v1.0.0

1.0.0.0

Robots.txt Generator

  Sources   Download

The Requires

 

The Development Requires

generator seo robots robots.txt