Search by

silarhi / llms-txt-bundle

guillaume-sainthillier

Build, dump and serve an llms.txt file from your Symfony application, the PrestaSitemapBundle way.

Package info

github.com/silarhi/llms-txt-bundle

Type:symfony-bundle

pkg:composer/silarhi/llms-txt-bundle

Statistics

Installs: 1 362

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v1.3.0 2026-10-12 10:32 UTC

This package is auto-updated.

Last update: 2026-10-16 15:07:32 UTC


README

License PHP Version CI Status Coverage

LLMs.txt Bundle

Build, dump and serve an llms.txt file from your Symfony application.
The PrestaSitemapBundle way: listeners fill it, a controller serves it, a command dumps it.

📖 Documentation

Features

  • Event driven: listeners of LlmsTxtPopulateEvent add the links, from your repositories, like SitemapPopulateEvent
  • Route options: static pages join the file with an llms_txt route option, like the sitemap one
  • On the fly or dumped: the controller serves the dumped file when there is one, and builds it otherwise
  • Flat memory: links added as generators are read one at a time, streamed to the response or the dumped file
  • Spec compliant: H1 title, blockquote summary, H2 sections of links, the Optional section always last, escaped links
  • Discovery: a <link> tag for the <head> of your pages and an opt-in Link header, through WebLink

Requirements

  • PHP 8.2+
  • Symfony 6.4, 7.x or 8.x

Installation

composer require silarhi/llms-txt-bundle

Import the route serving /llms.txt:

# config/routes/llms_txt.yaml
llms_txt:
    resource: '@LlmsTxtBundle/config/routes.php'

Quick start

# config/packages/llms_txt.yaml
llms_txt:
    title: 'SILARHI'
    summary: 'Web and mobile applications, from design to maintenance.'
use Silarhi\LlmsTxtBundle\Routing\LlmsTxtEntry;

#[Route('/contact', name: 'contact', options: ['llms_txt' => new LlmsTxtEntry(title: 'Contact')])]
public function contact(): Response

GET /llms.txt now lists the contact page. Add the pages of your database from an event listener, or dump the file with php bin/console llms-txt:dump.

Documentation

Everything else is on llms-txt-bundle.silarhi.dev:

Contributing

See CONTRIBUTING.md. Release notes are in CHANGELOG.md.

License

Released under the MIT License.