PHPackages                             knplabs/knp-markdown-bundle - 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. knplabs/knp-markdown-bundle

Abandoned → [twig/markdown-extra](/?search=twig%2Fmarkdown-extra)ArchivedSymfony-bundle[Parsing &amp; Serialization](/categories/parsing)

knplabs/knp-markdown-bundle
===========================

Knplabs markdown bundle transforms markdown into html

1.10.0(4y ago)4116.0M↓15.2%4920MITPHPPHP ^7.4|^8.0

Since Oct 15Pushed 4y ago29 watchersCompare

[ Source](https://github.com/KnpLabs/KnpMarkdownBundle)[ Packagist](https://packagist.org/packages/knplabs/knp-markdown-bundle)[ Docs](http://github.com/KnpLabs/KnpMarkdownBundle)[ RSS](/packages/knplabs-knp-markdown-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (20)Used By (20)

> **WARNING:** This bundle is **abandoned** in favor of [markdown\_to\_html](https://twig.symfony.com/doc/3.x/filters/markdown_to_html.html)Twig filter. Please, consider using it instead. Migration should be easy because it also supports `michelf/php-markdown` Markdown parser that is used in this project under the hood.

Provide markdown conversion (based on [Michel Fortin work](https://github.com/michelf/php-markdown)) to your Symfony projects.

[![Build Status](https://camo.githubusercontent.com/1bcc815b2773051d6cb8859281e9ecd8895d2062b9a3fa9910b96e97b958d3da/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4b6e704c6162732f4b6e704d61726b646f776e42756e646c652e737667)](http://travis-ci.org/KnpLabs/KnpMarkdownBundle)

[![ci.yml](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/ci.yml/badge.svg)[![php.yml](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/php.yml/badge.svg)](https://github.com/tacman/KnpMarkdownBundle/actions/workflows/php.yml/badge.svg)

INSTALLATION
------------

[](#installation)

Add KnpMarkdownBundle to your project via [Composer](https://getcomposer.org/):

```
composer require knplabs/knp-markdown-bundle

```

If you're *not* using Symfony Flex, you will also need to enable the bundle in your `app/AppKernel.php` file (`new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle()`).

That's it! Start using it!

USAGE
-----

[](#usage)

Once the bundle is installed, you can autowire a `MarkdownParserInterface`into any service or controller:

```
use Knp\Bundle\MarkdownBundle\MarkdownParserInterface;

// from inside a controller
public function index(MarkdownParserInterface $parser)
{
    $html = $parser->transformMarkdown($text);
}

// or from inside a service
private $parser;

public function __construct(MarkdownParserInterface $parser)
{
    $this->parser = $parser;
}

public function someMethod()
{
    $html = $this->parser->transformMarkdown($text);
}
```

There is also a public `markdown.parser` service you can use.

In Twig, you can use the `markdown` filter:

```
{# Use default parser #}
{{ my_data|markdown }}

{# If my_data is entered by a user, escape HTML tags before printing it #}
{{ my_data|escape|markdown }}
{# or strip HTML tags #}
{{ my_data|striptags|markdown }}

{# Or select specific parser #}
{{ my_data|markdown('parserName') }}
```

Change the parser implementation
--------------------------------

[](#change-the-parser-implementation)

Create a service implementing `Knp\Bundle\MarkdownBundle\MarkdownParserInterface`, then configure the bundle to use it:

```
# Symfony 3: app/config/config.yml
# Symfony 4: config/packages/knp_markdown.yaml (you'll need to create this)
knp_markdown:
    parser:
        service: my.markdown.parser
```

Alternatively if you are using the `markdown.parser.sundown` there are options for enabling sundown extensions and render flags, see the default Configuration with:

```
php bin/console config:dump-reference knp_markdown

```

This bundle comes with 5 parser services, 4 based on the same algorithm but providing different levels of compliance to the markdown specification, and one which is uses the php sundown extension:

```
- markdown.parser.max       // fully compliant = slower (default implementation)
- markdown.parser.medium    // expensive and uncommon features dropped
- markdown.parser.light     // expensive features dropped
- markdown.parser.min       // most features dropped = faster
- markdown.parser.sundown   // faster and fully compliant (recommended)

```

`markdown.parser.sundown` requires the [php sundown extension](https://github.com/chobie/php-sundown).

For more details, see the implementations in Parser/Preset.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity63

Solid adoption and visibility

Community44

Growing community involvement

Maturity77

Established project with proven stability

 Bus Factor5

5 contributors hold 50%+ of commits

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 ~199 days

Recently: every ~279 days

Total

18

Last Release

1573d ago

PHP version history (6 changes)1.1.0PHP &gt;=5.3.3

1.3.1PHP &gt;=5.3.9

1.6.0PHP &gt;=5.5.9

1.8.0PHP ^7.1.3

1.9.0PHP ^7.1.3|^8.0

1.10.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/202732?v=4)[KNP Labs](/maintainers/KnpLabs)[@KnpLabs](https://github.com/KnpLabs)

---

Top Contributors

[![ornicar](https://avatars.githubusercontent.com/u/140370?v=4)](https://github.com/ornicar "ornicar (39 commits)")[![weaverryan](https://avatars.githubusercontent.com/u/121003?v=4)](https://github.com/weaverryan "weaverryan (33 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (26 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (19 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (16 commits)")[![pilot](https://avatars.githubusercontent.com/u/28564?v=4)](https://github.com/pilot "pilot (16 commits)")[![akovalyov](https://avatars.githubusercontent.com/u/2339101?v=4)](https://github.com/akovalyov "akovalyov (15 commits)")[![abdounikarim](https://avatars.githubusercontent.com/u/15892761?v=4)](https://github.com/abdounikarim "abdounikarim (13 commits)")[![stloyd](https://avatars.githubusercontent.com/u/67402?v=4)](https://github.com/stloyd "stloyd (12 commits)")[![mbontemps](https://avatars.githubusercontent.com/u/231249?v=4)](https://github.com/mbontemps "mbontemps (11 commits)")[![Herzult](https://avatars.githubusercontent.com/u/177588?v=4)](https://github.com/Herzult "Herzult (6 commits)")[![matthieumota](https://avatars.githubusercontent.com/u/2427947?v=4)](https://github.com/matthieumota "matthieumota (5 commits)")[![pdenis](https://avatars.githubusercontent.com/u/1713289?v=4)](https://github.com/pdenis "pdenis (4 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (4 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (3 commits)")[![BattleRattle](https://avatars.githubusercontent.com/u/1455740?v=4)](https://github.com/BattleRattle "BattleRattle (3 commits)")[![BAKFR](https://avatars.githubusercontent.com/u/1631475?v=4)](https://github.com/BAKFR "BAKFR (3 commits)")[![elnur](https://avatars.githubusercontent.com/u/821060?v=4)](https://github.com/elnur "elnur (3 commits)")[![peterrehm](https://avatars.githubusercontent.com/u/2010989?v=4)](https://github.com/peterrehm "peterrehm (3 commits)")[![benji07](https://avatars.githubusercontent.com/u/166890?v=4)](https://github.com/benji07 "benji07 (3 commits)")

---

Tags

symfoy-bundlebundleknpknplabsmarkdown

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/knplabs-knp-markdown-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/knplabs-knp-markdown-bundle/health.svg)](https://phpackages.com/packages/knplabs-knp-markdown-bundle)
```

###  Alternatives

[knplabs/knp-paginator-bundle

Paginator bundle for Symfony to automate pagination and simplify sorting and other features

1.8k42.8M315](/packages/knplabs-knp-paginator-bundle)[knplabs/knp-snappy-bundle

Easily create PDF and images in Symfony by converting Twig/HTML templates.

1.2k31.8M49](/packages/knplabs-knp-snappy-bundle)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6308.9M39](/packages/knplabs-knp-time-bundle)[eprofos/user-agent-analyzer

A powerful Symfony bundle for user-agent analysis. It provides accurate detection of operating systems (Windows, MacOS, Linux, iOS, Android...), browsers (Chrome, Firefox, Safari...), and device types (Desktop, Mobile, Tablet, TV...). Supports specific version detection and includes advanced handling of special cases like WebViews and compatibility modes. Features comprehensive logging and detailed analysis results.

182.3k](/packages/eprofos-user-agent-analyzer)

PHPackages © 2026

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