Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Markdown Response Laravel Package

spatie/laravel-markdown-response

Serve markdown versions of your Laravel HTML pages for AI agents and bots. Detect markdown requests via Accept: text/markdown, known user agents, or .md URLs. Driver-based conversion (local PHP or Cloudflare Workers AI), with caching and HTML preprocessing.

View on GitHub
Deep Wiki
Context7

title: Introduction weight: 1

AI agents increasingly consume web content. This package lets your Laravel app serve markdown versions of HTML pages, making your content more accessible to AI crawlers and tools.

Add the middleware to your routes, and you're done:

use Spatie\MarkdownResponse\Middleware\ProvideMarkdownResponse;

Route::middleware(ProvideMarkdownResponse::class)->group(function () {
    Route::get('/about', [PageController::class, 'show']);
    Route::get('/posts/{post}', [PostController::class, 'show']);
});

Now when an AI agent visits /about (or a user visits /about.md), it receives a clean markdown version of the page instead of HTML. Your existing controllers and views stay exactly the same.

The package detects markdown requests through three mechanisms: Accept: text/markdown headers, .md URL suffixes, and known AI bot user agents like GPTBot and ClaudeBot.

The HTML-to-markdown conversion is driver-based. The default driver uses league/html-to-markdown and works locally without any external services. You can also use the Cloudflare Workers AI API for better conversion quality.

Converted responses are cached by default, so repeated requests skip the conversion entirely.

We got badges

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport