Download the PHP package soleinjast/symfony-markdown-response-bundle without Composer

On this page you can find all versions of the php package soleinjast/symfony-markdown-response-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-markdown-response-bundle

Symfony Markdown Response Bundle

Latest Stable Version Total Downloads PHP Symfony

Introduction

A Symfony bundle that automatically serves Markdown versions of your HTML pages to AI agents, bots, and any client that requests it. Controllers opt in with a single PHP attribute — the bundle handles detection, conversion, and caching transparently.


Why

AI assistants (ChatGPT, Claude, Perplexity, etc.) and autonomous agents consume web content better as plain Markdown than as HTML. Stripping navigation, scripts, styles, and markup noise reduces token usage and improves comprehension — without maintaining a separate content pipeline.


Installation

If you are not using Symfony Flex, register the bundle manually:


Quick Start

1. Opt a controller in

Apply the #[ProvideMarkdownResponse] attribute to a controller class or to individual action methods.

Or enable it per-method and disable it on specific actions:

2. That's it

The bundle detects AI clients automatically. No changes to routes, templates, or responses are required.


How Detection Works

A request is considered to want Markdown if any of the following is true:

Signal Example
Accept: text/markdown header Accept: text/markdown, */*
.md URL suffix GET /docs/setup.md
Known AI User-Agent substring User-Agent: GPTBot/1.0
_wants_markdown request attribute Set internally after .md rewrite

The .md suffix is stripped before routing so your route definitions remain unchanged. The _wants_markdown attribute is set on the request to carry the intent forward to the response phase.

Default User-Agent patterns:


Configuration

Publish the configuration file (optional — all keys have defaults):

Configuration reference

Key Type Default Description
driver local\|cloudflare local Conversion backend
cloudflare_endpoint string\|null null Cloudflare Workers AI URL (required for cloudflare driver)
cache_enabled bool true Cache converted Markdown
cache_ttl int 3600 Cache TTL in seconds
cache_service string\|null null PSR-6 cache pool service ID; falls back to cache.app then cache.system
ai_user_agents string[] (see above) User-Agent substrings that trigger Markdown responses

Conversion Drivers

local (default)

Uses league/html-to-markdown. Conversion happens in-process with no external dependencies. The following HTML nodes are stripped before conversion: head, script, style, nav, footer, aside.

cloudflare

Posts the HTML to a Cloudflare Workers AI endpoint and returns the response body as Markdown. Requires symfony/http-client and a configured endpoint URL.


Caching

Converted Markdown is cached by default using a PSR-6 cache pool. The cache key is derived from an xxh3 hash of the pre-processed HTML, so distinct page content produces distinct cache entries.

Resolution order for the cache pool:

  1. cache_service if explicitly configured
  2. cache.app if present in the container
  3. cache.system if present in the container
  4. No caching (conversion runs on every request)

To disable caching entirely:


Preprocessing Pipeline

You can strip or transform HTML before conversion by implementing HtmlPreprocessorInterface. Services implementing this interface are auto-configured via the symfony_markdown_response.html_preprocessor tag.

Register it as a service (or rely on autowiring/autoconfiguration):

Multiple preprocessors are applied in the order they are resolved from the container.


Accessing Markdown Programmatically

The MarkdownConverter service is available for injection if you need to convert HTML outside of the HTTP cycle:


Requesting Markdown as a Client

There are three ways to request a Markdown response:

1. URL suffix

2. Accept header

3. Known AI User-Agent (automatic — no client changes required)

All three methods produce a response with Content-Type: text/markdown; charset=UTF-8.


Contributing

Contributions are welcome. Please open an issue before submitting a pull request for significant changes so the approach can be discussed first.

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/my-feature
  3. Write tests for your changes
  4. Submit a pull request

License

Released under the MIT License.


Happy coding! 🎉


All versions of symfony-markdown-response-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/http-kernel Version ^6.4|^7.0|^8.0
symfony/dependency-injection Version ^6.4|^7.0|^8.0
symfony/config Version ^6.4|^7.0|^8.0
league/html-to-markdown Version ^5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package soleinjast/symfony-markdown-response-bundle contains the following files

Loading the files please wait ...