Weave 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

Markdown Bundle Laravel Package

raphy/markdown-bundle

A Symfony bundle for working with Markdown in your applications, making it easy to parse and render Markdown content through the framework's service and template layers with minimal configuration.

View on GitHub
Deep Wiki
Context7

Getting Started

Before installing, know what you're getting: raphy/markdown-bundle is a Symfony bundle, not a Laravel package. It ships no ServiceProvider, no facade, and no config/markdown.php. It has had no release since June 2018, 4 stars, and 0 dependents — treat it as a dead upstream that wraps an existing Markdown parser (check composer.json for the underlying lib; historical versions wrap michelf/php-markdown / MarkdownExtra).

Step 1 — Evaluate before you commit. Run composer show raphy/markdown-bundle --all and inspect the require block. If it pins PHP 7.x or Symfony 3/4 components, it will fight with a modern Laravel app. If it does, stop here and use league/commonmark (actively maintained, framework-agnostic) or erusev/parsedown directly.

Step 2 — If you proceed, install it and locate the real work. The bundle is thin; the actual Markdown conversion is a service you can instantiate yourself:

composer require raphy/markdown-bundle

Browse vendor/raphy/markdown-bundle/ — look at Resources/config/services.* for the service id and class, and at its composer.json for the parser dependency.

Step 3 — Wire it manually in AppServiceProvider::register():

use Raphy\MarkdownBundle\Service\Markdown; // adjust to actual class name

$this->app->singleton('markdown', fn () => new Markdown());

First real use case: rendering trusted Markdown (READMEs, CMS-authored article bodies, changelogs) into HTML inside a Blade view. Do not start with user-submitted content until you've solved sanitization (see Gotchas).

Implementation Patterns

Blade directive. Once registered as a singleton, expose it as a directive so views stay clean:

// AppServiceProvider::boot()
Blade::directive('markdown', fn ($expr) => "<?php echo app('markdown')->transform($expr); ?>");
<article>{!! @markdown($post->body) !!}</article>

Facade for controllers and jobs.

class Markdown extends Facade {
    protected static function getFacadeAccessor() { return 'markdown'; }
}

Render once, cache the HTML. Parsing on every request is wasteful for static content. Store both the raw Markdown and the rendered HTML, and invalidate on save:

protected static function booted()
{
    static::saving(function ($post) {
        if ($post->isDirty('body')) {
            $post->body_html = app('markdown')->transform($post->body);
        }
    });
}

API responses. Return both body (raw, so clients can re-render) and body_html (for direct consumption) — a common pattern in Laravel JSON resources.

Content pipeline stage. If you're ingesting external content, chain it: strip_tags → markdown → HTMLPurifier::purify. Centralize this in a single MarkdownRenderer service rather than scattering calls.

Testing. Keep a fixture directory of .md inputs and expected .html outputs, and snapshot-test your wrapper — that's the only reliable regression check you'll get from an unmaintained dependency.

Gotchas and Tips

  • No ServiceProvider = no auto-discovery. In Laravel 5.5+ packages auto-load, but Symfony bundles do not. You must instantiate the service yourself (as shown above). There is no php artisan vendor:publish here.
  • XSS by default. michelf/php-markdown passes raw HTML straight through. A <script> in a post body renders as a live script. Always sanitize output with mews/purifier or HTMLPurifier before {!! !!}.
  • Blade escaping trap. {!! ... !!} is required, but it also means everything the parser emits is trusted. Wrap sanitization inside your renderer so no view can forget it.
  • PHP version conflicts are the likely failure mode. A 2018 dependency graph often means PHP 7.x-era constraints. If composer require fails on PHP 8, use --ignore-platform-reqs only to inspect, not deploy — or skip the package.
  • Extension points are in the underlying parser, not the bundle. Table support, footnotes, syntax highlighting — all come from MarkdownExtra / the parser's options. Read the upstream docs, not the bundle's (which is a one-page README).
  • No config file. To change behavior (safe mode, extensions), you'll edit the wrapper class or bind your own configured parser instance in a ServiceProvider. Forking the wrapper (30 lines) is often cleaner than binding around it.
  • Upgrade strategy. Because this is abandoned, commit to one of: (a) pin the exact version and accept no security patches, (b) fork the thin wrapper into app/Support/Markdown/ and drop the dependency, or (c) migrate to league/commonmark (same interface idea, actively maintained, ships a MarkdownConverter you can bind to the container in five lines).
  • Debugging parse output. When output looks wrong, dump the raw parser result before any sanitizer runs — most "Markdown broken" bugs are actually the purifier stripping allowed tags (tables, style=, id=).
  • Bottom line. For greenfield Laravel work, recommend league/commonmark and skip this bundle. Reach for raphy/markdown-bundle only if you're maintaining an existing Symfony app that already depends on it, or if you're porting and only need the wrapper class as a reference.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource