zmr-robin/php-markdown

PHPMarkdown is a simple PHP class that converts Markdown syntax into HTML.

Maintainers

Package info

github.com/zmr-robin/php-markdown

Type:libary

pkg:composer/zmr-robin/php-markdown

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.3 2026-02-21 23:37 UTC

This package is auto-updated.

Last update: 2026-04-13 01:24:27 UTC


README

Lightweight PHP Markdown to HTML Parser

PHPMarkdown is a simple yet powerful PHP class that converts Markdown syntax into HTML.

Features

  • Converts Markdown headers
  • Supports bold, italic, underline, strikethrough, and ==highlight==
  • Handles unordered and numbered lists
  • Converts blockquotes
  • Converts hyperlinks
  • Converts images
  • Maintains nested lists and mixed content formatting
  • Easy to extend with additional Markdown syntax

Installation

1. Install package using composer

composer require zmr-robin/php-markdown

2. Include the class in your project

require_once 'vendor/autoload.php';
$parser = new PHPMarkdown();

2. Convert a Markdown file to HTML

$file = file('example.md');
$html = $parser->convertFileToHtml($file);
echo $html;

3. Or convert a single line

$htmlLine = $parser->convertLineToHtml("**Bold text** and *italic*");
echo $htmlLine; 
// Outputs: <b>Bold text</b> and <i>italic</i>

Example

Markdown Input

# Header 1
* Item 1
* Item 2
> Quote example
**Bold text** and *italic text* [Google](https://www.google.com)

HTML Output

<h1>Header 1</h1>
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>
<blockquote>Quote example</blockquote>
<b>Bold text</b> and <i>italic text</i> <a href='https://www.google.com'>Google</a>