PHPackages                             tekord/robots-txt-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. tekord/robots-txt-provider

ActiveLibrary[Search &amp; Filtering](/categories/search)

tekord/robots-txt-provider
==========================

Provides various framework-agnostic ways to generate the contents of the robots.txt file

1.0(4y ago)04MITPHPPHP ^7.4|^8.0

Since Jun 6Pushed 4y agoCompare

[ Source](https://github.com/tekord/robots-txt-provider)[ Packagist](https://packagist.org/packages/tekord/robots-txt-provider)[ Docs](https://github.com/tekord/robots-txt-provider)[ RSS](/packages/tekord-robots-txt-provider/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Framework-agnostic ROBOTS.TXT File Content Generator Kit
========================================================

[](#framework-agnostic-robotstxt-file-content-generator-kit)

This package provides various framework-agnostic ways to generate the contents of the robots.txt file.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tekord/robots-txt-provider
```

Usage
-----

[](#usage)

Here are the available content providers:

- StringContentProvider - returns a plain string
- FileContentProvider - returns the contents of the specified file
- CallbackContentProvider - used a callback to get the value
- CompositeContentProvider - used to compose multiple providers, returns the value of the first provider that returns a non-NULL value

### ContentBuilder

[](#contentbuilder)

The ContentBuilder class provides handy methods for generating content:

```
ContentBuilder::make()
    ->line("User-Agent: *")
    ->emptyLine()
    ->comment("This is a comment")
    ->parameter("Host", "https://example.com")
    ->allow("/about")
    ->disallow("/login")
    ->build();
```

Will return the following:

```
User-Agent: *

# This is a comment
Host: https://example.com
Allow: /about
Disallow: /login

```

The following methods have a conditional version: `line`, `emptyLine`, `comment`, `parameter`, `allow` and `disallow`. Just add `If` to the end of the method name like `lineIf`. The first parameter is a condition (boolean or callback). If the condition is TRUE then the method executes. For instance:

```
$debugMode = true;

$useSpecialUserAgent = function () {
    return false;
};

ContentBuilder::make()
    ->lineIf($useSpecialUserAgent, "User-Agent: Bot/1.0")
    ->lineIf(!$useSpecialUserAgent, "User-Agent: *")
    ->emptyLine()
    ->commentIf($debugMode, "Debug mode is active")
    ->parameter("Host", "https://example.com")
    ->disallow("/")
    ->build();
```

Will return the following:

```
User-Agent: *

# Debug mode is active
Host: https://example.com
Disallow: /

```

### StringContentProvider

[](#stringcontentprovider)

```
$content = line("User-Agent: *")
        ->emptyLine()
        ->comment("This content was generated by the CallbackContentProvider class")
        ->parameter("Host", "https://example.com")
        ->disallow("/")
        ->build();
});
```

### CompositeContentProvider

[](#compositecontentprovider)

```
$productionFileContentProvider = new FileContentProvider(__DIR__ . "/public/robots.production.txt");
$defaultFileContentProvider = new FileContentProvider(__DIR__ . "/public/robots.default.txt");
$fallbackFileContentProvider = new StringContentProvider("User-Agent: *\nDisallow: /");

$compositeContentProvider = (new CompositeContentProvider())
    ->addContentProvider($productionFileContentProvider)
    ->addContentProvider($defaultFileContentProvider)
    ->addContentProvider($fallbackFileContentProvider);
```

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1800d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f3c0971c1772194004645045af84bba7059bff710578b4a29c97d850c51cbdf?d=identicon)[tekord](/maintainers/tekord)

---

Top Contributors

[![tekord](https://avatars.githubusercontent.com/u/1286100?v=4)](https://github.com/tekord "tekord (18 commits)")

---

Tags

content-generationframework-agnosticphprobots-txtseoseo-optimizationsearchseorobotsindexingrobots.txt

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tekord-robots-txt-provider/health.svg)

```
[![Health](https://phpackages.com/badges/tekord-robots-txt-provider/health.svg)](https://phpackages.com/packages/tekord-robots-txt-provider)
```

###  Alternatives

[ripaclub/sphinxsearch

Sphinx Search library provides SphinxQL indexing and searching features

6232.2k3](/packages/ripaclub-sphinxsearch)[quinninteractive/silverstripe-seo

An all-in-one SEO module for SilverStripe

3328.2k](/packages/quinninteractive-silverstripe-seo)[ymigval/laravel-indexnow

Laravel Service Library for notifying search engines about the latest content changes on their URLs using IndexNow.

3410.2k](/packages/ymigval-laravel-indexnow)[mediamonks/crawler

Crawl your own website with various clients for SEO and indexing purposes.

211.1k1](/packages/mediamonks-crawler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
