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 clean markdown versions of your Laravel HTML pages for AI agents and bots. Detects requests via Accept: text/markdown, known user agents, or .md URLs. Driver-based conversion (local PHP or Cloudflare Workers AI), caching, and HTML preprocessing included.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • AI-First Content Strategy: Enable seamless integration with AI agents (e.g., ChatGPT, Claude) by serving clean, structured markdown instead of bloated HTML. Aligns with roadmaps for AI-driven discovery, knowledge graphs, or internal AI tools.
  • Build vs. Buy: Avoid reinventing HTML-to-markdown conversion logic (e.g., parsing, caching, or driver management). Leverage a battle-tested, MIT-licensed package with Cloudflare/League drivers.
  • Developer Experience: Reduce friction for frontend teams by adding .md endpoints or AI user-agent detection without modifying existing controllers/views. Supports progressive enhancement.
  • Performance Optimization: Cache markdown responses (TTL-configurable) to offload conversion logic from runtime, critical for high-traffic sites.
  • Testing & Debugging: Built-in facade for testing conversions (e.g., Markdown::fake()) accelerates QA for AI integrations or content migrations.
  • Multi-Channel Publishing: Unify content delivery across web, AI, and CLI tools (e.g., curl --header "Accept: text/markdown" https://example.com/about).

When to Consider This Package

  • Adopt if:

    • Your Laravel app serves content to AI agents (e.g., knowledge bases, documentation, or public APIs).
    • You need to support .md URLs or Accept: text/markdown headers without rewriting routes/controllers.
    • Performance is critical, and you want to cache converted responses (default: 1-hour TTL).
    • Your team lacks bandwidth to build/maintain HTML-to-markdown conversion logic.
    • You’re using Cloudflare Workers and want to offload conversion to their AI API for better JS/rich-content support.
  • Look elsewhere if:

    • Your app doesn’t interact with AI agents or need markdown endpoints (overkill for pure web use).
    • You require real-time markdown generation (caching may not suit your use case).
    • Your HTML is highly dynamic (e.g., heavy JS frameworks like React/Vue) and needs pre-rendering before conversion.
    • You’re not using Laravel (package is framework-specific).
    • You need advanced markdown features (e.g., custom syntax extensions) beyond standard conversion.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us serve clean, AI-friendly markdown versions of our web content—automatically—without touching our existing codebase. Think of it as a ‘dark mode’ for AI: instead of sending bloated HTML to bots like ChatGPT, we deliver structured markdown, improving parsing accuracy and reducing API costs. It’s a low-risk, high-reward play for our AI integrations, documentation, or knowledge graph initiatives. The caching layer ensures no performance hit, and the Cloudflare driver option future-proofs us for richer content."

For Engineering:

*"Spatie’s laravel-markdown-response gives us three ways to serve markdown:

  1. Automatic: Detect AI user agents or .md URLs (e.g., /about.md).
  2. Explicit: Use Accept: text/markdown headers for programmatic access.
  3. Programmatic: Convert HTML strings directly via Markdown::convert($html). It’s middleware-based (zero controller changes), supports League (local) or Cloudflare (serverless) drivers, and includes caching + testing tools. We can roll it out incrementally—start with docs or public APIs—and disable it entirely if needed (MARKDOWN_RESPONSE_ENABLED=false). The MIT license and Spatie’s track record make it a safe bet."*

For Product/Design:

*"This unlocks AI agents to consume our content more effectively. For example:

  • Chatbots: Serve markdown for /support or /pricing to improve response quality.
  • Internal Tools: Let engineers fetch markdown versions of docs via API (e.g., for CLI tools).
  • SEO/AI: Google’s SGE and other AI search tools may prefer structured markdown over HTML. No design changes needed—just add .md to URLs or let the middleware handle it. We can A/B test impact on AI interactions."*
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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony