PHPackages                             spatie/laravel-markdown-response - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. spatie/laravel-markdown-response

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

spatie/laravel-markdown-response
================================

Serve markdown versions of your HTML pages to AI agents and bots

1.2.2(3mo ago)7985.9k↑60.3%82MITPHPPHP ^8.4CI passing

Since Feb 17Pushed 1mo agoCompare

[ Source](https://github.com/spatie/laravel-markdown-response)[ Packagist](https://packagist.org/packages/spatie/laravel-markdown-response)[ Docs](https://github.com/spatie/laravel-markdown-response)[ GitHub Sponsors](https://github.com/Spatie)[ RSS](/packages/spatie-laravel-markdown-response/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (8)Dependencies (45)Versions (14)Used By (2)

 [   ![Logo for laravel-markdown-response](https://camo.githubusercontent.com/e885aa06845ff1da68e26b0c436df80b4db9342fb17d5d3cbeaa839413c8d20c/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d6d61726b646f776e2d726573706f6e73652f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-markdown-response)Serve markdown versions of your HTML pages to AI agents and bots
================================================================

[](#serve-markdown-versions-of-your-html-pages-to-ai-agents-and-bots)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c425336cf3cc352bba82b3299d5f4ae908a4869dabdee447f05bab6db3c71762/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d6d61726b646f776e2d726573706f6e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-markdown-response)[![GitHub Tests Action Status](https://github.com/spatie/laravel-markdown-response/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/laravel-markdown-response/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://github.com/spatie/laravel-markdown-response/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/spatie/laravel-markdown-response/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c0763c8f04854a6d3dff34f793b4e6812923a9201053cba7bd694c8d013841f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d6d61726b646f776e2d726573706f6e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-markdown-response)

AI agents increasingly consume web content. This package lets your Laravel app serve markdown versions of HTML pages. Markdown requests are detected via `Accept: text/markdown` header, known AI user agent patterns, or `.md` URL suffix. The conversion is driver-based (local PHP or Cloudflare Workers AI), results are cached, and HTML can be preprocessed before conversion.

Here's a quick example:

```
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`, they receive a clean markdown version of the page.

You can also convert HTML to markdown directly:

```
use Spatie\MarkdownResponse\Facades\Markdown;

$markdown = Markdown::convert($html);
```

And test your conversions:

```
use Spatie\MarkdownResponse\Facades\Markdown;

it('converts the about page to markdown', function () {
    Markdown::fake();

    $this->get('/about.md')->assertOk();

    Markdown::assertConverted();
});
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/6380ddf22dd90183aec3bdd66c7237487058d8da0cb32dc2ed37b8e332cf781a/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d6d61726b646f776e2d726573706f6e73652e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-markdown-response)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

All documentation is available [on our documentation site](https://spatie.be/docs/laravel-markdown-response).

Testing
-------

[](#testing)

You can run the tests with:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 82.2% 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

Every ~10 days

Recently: every ~19 days

Total

9

Last Release

101d ago

Major Versions

0.0.2 → 1.0.02026-02-18

0.1.0 → 1.1.02026-02-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (37 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![moisish](https://avatars.githubusercontent.com/u/15047879?v=4)](https://github.com/moisish "moisish (1 commits)")[![nanos](https://avatars.githubusercontent.com/u/5182595?v=4)](https://github.com/nanos "nanos (1 commits)")[![sevenpixels](https://avatars.githubusercontent.com/u/502377?v=4)](https://github.com/sevenpixels "sevenpixels (1 commits)")

---

Tags

ailaravelmarkdownphpspatielaravelaimarkdownbot

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/spatie-laravel-markdown-response/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-laravel-markdown-response/health.svg)](https://phpackages.com/packages/spatie-laravel-markdown-response)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

13.0k107.5M1.6k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k5.4M50](/packages/spatie-laravel-pdf)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M189](/packages/spatie-laravel-health)[spatie/laravel-passkeys

Use passkeys in your Laravel app

4721.0M48](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

46273.9k](/packages/harris21-laravel-fuse)

PHPackages © 2026

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