You can use PHP Markdown without Composer or an autoloader: its project documents directly including its .inc.php files. That does not make it dependency-free in the strict sense of using only PHP’s built-in features. The phrase “no dependencies” can mean no Composer packages, no autoloader, no extra PHP extension, or no third-party code at all—and those are different requirements.
What “no dependencies” means for a PHP Markdown parser
Markdown is a plain-text markup syntax; a Markdown parser is software that converts that syntax into HTML. PHP Markdown is a PHP port of the original Markdown program. Its project provides both Markdown and MarkdownExtra parser classes and requires PHP 7.4 or later for the current library package. Read the PHP Markdown project documentation.
As an Amazon Associate I earn from qualifying purchases.
Choose the constraint you actually need to satisfy:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11- No Composer: You can install code without running Composer, but it remains third-party PHP code.
- No autoloader: PHP Markdown documents a direct-include route for this case.
- No added PHP extension: Avoid solutions that require installing a runtime extension, such as PHP’s CommonMark extension.
- No third-party code or components: None of the libraries or the extension below meet this strict definition. A handwritten parser would be custom code, and a limited implementation should not be mistaken for complete Markdown support.
Use PHP Markdown without an autoloader
If your specific obstacle is class autoloading, PHP Markdown’s project documentation describes including its .inc.php entry point directly. This is an alternative installation route—not a claim that the parser is built into PHP. The current library package requires PHP 7.4 or later.
#1 Best Overall
- Get the current PHP Markdown library files using the project’s documented installation options. Composer is one option, not the only one.
- Include the appropriate
.inc.phpentry point from your application, using the path where you placed the library files. - Use the parser class you need:
Markdownfor Markdown orMarkdownExtrafor Markdown Extra. - Render a representative sample from your content and verify the output matches the syntax your site accepts.
The project also distinguishes this library package from an older plugin/library hybrid that it says is no longer maintained; use the current library documentation rather than relying on that older hybrid. PHP Markdown README and installation guidance.
How the main PHP options differ
| Option | Dialect and capabilities | Runtime and installation | What “no dependencies” can mean |
|---|---|---|---|
| PHP Markdown | Markdown and Markdown Extra | PHP 7.4 or later; Composer or direct inclusion of .inc.php files |
No Composer or autoloader is possible; it is still third-party PHP code. |
| league/commonmark | CommonMark and GitHub-Flavored Markdown (GFM); the GFM converter includes tables, task lists, strikethrough, autolinks, and disallowed raw HTML | PHP 7.4 or later and the mbstring extension; Composer is the documented installation route |
Not a no-package or no-extension choice. |
| PHP CommonMark extension | Parsing and rendering APIs for CommonMark | Installed separately through PECL | Not a no-extra-component choice; it adds a runtime extension. |
See the league/commonmark documentation for its installation, dialects, and configuration. The PHP CommonMark manual describes the extension API, and PHP’s installation notes point to PECL.
Rank #2
Protect pages that render untrusted Markdown
Parsing Markdown is not the same as sanitizing HTML. In league/commonmark, raw HTML and unsafe link protocols are allowed by default for specification compliance. If users can submit Markdown, its security guide recommends configuring those behaviors deliberately:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Set
html_inputtoescapeorstripto control raw HTML. - Set
allow_unsafe_linkstofalseto reject unsafe link protocols. - Set
max_nesting_levelto100for untrusted input, as the guide recommends. - Consider limiting
max_delimiters_per_line. This does not constrain link and image brackets, so apply upstream input-size and line-length limits where appropriate.
Additional filtering may be needed for some applications. The project warns that filters need careful configuration and testing; do not treat a Markdown parser’s output as automatically safe for every context. league/commonmark security guidance.
Quick Recap
Rank #4
Choose the option that fits your actual constraint
- Choose PHP Markdown’s direct-include route if you need to avoid Composer or an autoloader and its dialects fit your content.
- Choose league/commonmark if CommonMark or GFM support fits your needs and Composer plus
mbstringare acceptable. - Choose the PHP CommonMark extension only if installing a separate runtime component is acceptable.
- If you require zero third-party code, none of these options qualify. A custom parser must be explicitly scoped and tested; do not assume a short implementation handles Markdown’s edge cases or conforms to a full specification.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




