Download the PHP package iliaal/mdparser without Composer

On this page you can find all versions of the php package iliaal/mdparser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mdparser

mdparser

Tests Windows Build Version License: BSD-3-Clause Follow @iliaa

Native C CommonMark + GitHub Flavored Markdown parser for PHP. ~10-20× faster than pure-PHP alternatives (Parsedown, cebe, michelf) on a clean optimized build, targeting CommonMark 0.31 (652/652 spec examples pass; see docs/spec-coverage.md). GFM extensions: tables, strikethrough, task lists, autolinks, tagfilter. Installable via PIE (the PHP Foundation's PECL successor); ships as a single .so. PHP 8.2 minimum, OO API with final classes and readonly options.

📦 Install

On a minimal PHP image (e.g. php:8.x-cli from Docker Hub), PIE needs a few build tools installed first:

From source

Windows binaries

Pre-built DLLs for PHP 8.3, 8.4, and 8.5 (TS/NTS, x86/x64) are attached to each GitHub release.

🛠️ Usage

📊 Performance

Against the major pure-PHP Markdown libraries, on PHP 8.4 (clean optimized build, each parser in its default configuration):

Corpus mdparser ops/sec Best pure-PHP ops/sec Speedup
200 B ~530,000 ~26,000 (Parsedown) ~20×
1.8 KB ~110,000 ~6,000 (cebe/GitHub) ~19×
200 KB ~980 ~95 (cebe/GitHub) ~10×

Against the slowest pure-PHP parser the gap reaches ~45×. bench/README.md has the methodology, all parsers, caveats, league/commonmark notes, and reproduction steps. Benchmark a clean optimized PHP build; a debug or ASan build skews the numbers.

✨ Feature matrix

Comparison with the major pure-PHP Markdown libraries. "via ext" means the feature exists but requires opting in to a non-default extension; "Extra" means the feature ships in the library's Markdown Extra dialect, not its base mode; "✗" means the feature is not supported at all.

Feature mdparser Parsedown league/cm core cebe GFM michelf Extra Ciconia
CommonMark core ✓ partial ✓ partial partial partial
Fenced code blocks ✓ ✓ ✓ ✓ ✓ ✓
GFM tables ✓ ✓ via ext ✓ via Extra ✓
Strikethrough ✓ ✓ via ext ✓ ✗ ✓
Task lists ✓ ✗ via ext ✗ ✗ ✓
Autolinks (bare URL) ✓ ✓ via ext ✓ ✗ ✓
<script> tag filter ✓ (tagfilter) ✓ (escaped) via ext partial ✗ ✗
Smart punctuation ✓ (Options::smart) ✗ via ext ✗ ✗ ✗
Footnotes ✓ (Options::footnotes) Extra via ext ✗ ✓ Extra plugin
Hardbreaks/nobreaks ✓ ✗ ✗ ✗ ✗ ✗
Sourcepos ✗ ✗ ✓ ✗ ✗ ✗
Heading anchors ✓ (Options::headingAnchors) ✗ via ext ✗ ✗ ✗
rel="nofollow" ✓ (Options::nofollowLinks) ✗ via ext ✗ ✗ ✗
HTML output ✓ ✓ ✓ ✓ ✓ ✓
XML output ✓ ✗ ✗ ✗ ✗ ✗
AST output ✓ (arrays) ✗ ✓ (objects) ✗ ✗ ✗

Opt-in dialect extensions

md4c also ships dialect extensions beyond CommonMark + GFM. Each one is an opt-in Options flag, off by default: latexMath ($inline$, $$block$$), wikiLinks ([[target]]), spoilers (||text||), underline, highlight (==text==), superscript (^text^), subscript (~text~), admonitions (GitHub-style > [!NOTE] alert blocks), insert (++text++ renders <ins>), and preserveBlankLines (blank-line runs are reported instead of discarded, visible in toXml() and toAst()). Parser-behavior toggles: noIndentedCodeBlocks, permissiveAtxHeadings, collapseWhitespace. See docs/options.md for behavior and edge cases.

What we don't cover

mdparser covers CommonMark core plus the GFM extensions. It doesn't implement the "Markdown Extra" features found in Parsedown Extra, michelf Markdown Extra, and league/commonmark's optional extensions. If you need any of the following, use league/commonmark, the most actively maintained pure-PHP option for extended Markdown:

Bounding parse memory

The parser's own working memory comes from libc rather than Zend MM, so memory_limit never sees it. In measured release builds, [-dense input used about 76-87 bytes of parser state per input byte, and >-dense input about 45-52 bytes. Without a parse budget, a 16 MiB [-dense input can request more than 1 GiB.

mdparser.parse_memory_limit caps what a single parse may hold, defaulting to 128M. Crossing it throws MdParser\Exception. The setting is PHP_INI_ALL, takes the usual 128M / 1G shorthand, and treats an empty value as the default 128M; explicit 0 or any negative value is unlimited. With the limit off, a 256 MiB [-dense input could ask libc for roughly 19-22 GiB at the measured per-byte rate. Raise the limit if you render very large documents; lower it if you render untrusted Markdown in long-lived workers. Rendered output is separate and stays under memory_limit.

A note on unsafe: true

Options::unsafe = true passes raw HTML through verbatim instead of escaping or stripping it. Use it only for input you own or a pipeline you trust. headingAnchors and nofollowLinks run in-stream as md4c parses the source, so they touch only Markdown-derived nodes. Raw HTML is emitted verbatim and never rewritten:

Structural outputs are unsanitized

Parser::toXml() and Parser::toAst() return structural representations of the parsed document. html_block / html_inline literals are preserved byte-for-byte (XML-escaped in toXml()); link and image URLs and titles are entity-decoded but not scheme-filtered. The unsafe, tagfilter, and URL-scheme defenses don't make these outputs safe to turn back into HTML. If you build HTML from XML or AST data, apply a URL scheme allowlist before emitting href, and run html_block / html_inline literal text through a sanitizer. See docs/ast.md for examples.

🔗 Native PHP extensions

Companion native PHP extensions:

📚 Read more

The launch post covers background, design rationale, and benchmark methodology: mdparser: A Native CommonMark + GFM Parser for PHP.

License


Follow @iliaa on X • Blog • If this sped up your stack, ⭐ star it!


All versions of mdparser with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package iliaal/mdparser contains the following files

Loading the files please wait ...