PHPackages                             daryledesilva/markdown-to-mrkdwn-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. daryledesilva/markdown-to-mrkdwn-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

daryledesilva/markdown-to-mrkdwn-php
====================================

Convert standard Markdown to Slack's mrkdwn format

v1.2.0(11mo ago)011.1k—4.9%[1 issues](https://github.com/daryledesilva/markdown-to-mrkdwn-php/issues)MITPHPPHP &gt;=7.4CI passing

Since May 14Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/daryledesilva/markdown-to-mrkdwn-php)[ Packagist](https://packagist.org/packages/daryledesilva/markdown-to-mrkdwn-php)[ RSS](/packages/daryledesilva-markdown-to-mrkdwn-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

markdown-to-mrkdwn-php
======================

[](#markdown-to-mrkdwn-php)

[![Packagist Version](https://camo.githubusercontent.com/f26110484c8b30ab623477e8a22d08594cb2dc914742005988a56ae0402baa94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646172796c65646573696c76612f6d61726b646f776e2d746f2d6d726b64776e2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daryledesilva/markdown-to-mrkdwn-php)[![License: MIT](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

A lightweight, dependency-free PHP library for converting Markdown into Slack-compatible mrkdwn. It preserves code blocks, handles tables, blockquotes, lists, and more for seamless Slack messaging.

💡 What is this?
---------------

[](#-what-is-this)

An easy-to-use, dependency-free PHP 7.4+ library that converts Markdown—headings, text formatting, lists, tables, blockquotes, and code blocks—into Slack’s mrkdwn format. Ideal for bots, integrations, or any app sending rich text to Slack.

✨ Features
----------

[](#-features)

```
- Headings (H1–H6 → `*Heading*`)
- Text formatting:
  - Bold (`**bold**` → `*bold*`)
  - Italic (`*italic*` or `_italic_` → `_italic_`)
  - Strikethrough (`~~strike~~` → `~strike~`)
- Lists:
  - Unordered & ordered (with nesting)
  - Task lists (`- [ ]` / `- [x]` → `• ☐` / `• ☑`)
- Tables (simple text tables with bold headers)
- Links & images:
  - `[text](url)` → ``
  - `![alt](url)` → ``
- Code:
  - Inline `` `code` ``
  - Fenced code blocks (```…```), preserving language hint
- Blockquotes (`> quote`)
- Horizontal rules (`---`, `***`, `___` → `──────────`)
```

📋 Supported Conversions
-----------------------

[](#-supported-conversions)

MarkdownSlack mrkdwn`# Heading``*Heading*``**Bold**``*Bold*``*Italic*` / `_Italic_``_Italic_``~~Strike~~``~Strike~``- [ ] Task``• ☐ Task``- [x] Task``• ☑ Task``- Item` / `1. Item``• Item` / `1. Item```Inline code````Inline code`````lang```langcodecode```````> Quote``> Quote``---` / `***` / `___``──────────`🔌 Plugin System
---------------

[](#-plugin-system)

You can extend the converter with custom plugins (global, line or block scope):

```
use DaryleDeSilva\MarkdownToMrkdwn\Converter;

$converter = new Converter();

// Global plugin (runs on full text)
$converter->registerPlugin(
    'addQuotes',
    fn(string $text) => "\"{$text}\"",
    priority: 10,
    scope: 'global'
);

// Line plugin (before standard conversion)
$converter->registerPlugin(
    'linePrefix',
    fn(string $line) => "[LINE] {$line}",
    priority: 20,
    scope: 'line',
    timing: 'before'
);

echo $converter->convert("**Hello**, world!");
```

### Advanced plugin examples

[](#advanced-plugin-examples)

```
// Function plugin: convert entire text to uppercase
$converter->registerPlugin(
    name: 'toUpper',
    converter_func: fn(string $text) => strtoupper($text),
    priority: 10,
    scope: 'line',
    timing: 'after'
);

// Regex plugin: mask email addresses
$converter->registerRegexPlugin(
    name: 'maskEmails',
    pattern: '/[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+/',
    replacement: '[EMAIL]',
    priority: 20,
    timing: 'after'
);
```

### Error handling

[](#error-handling)

If an error occurs during conversion, the original Markdown text is returned unmodified.

🛠 Requirements
--------------

[](#-requirements)

- PHP 7.4 or higher

📦 Installation
--------------

[](#-installation)

```
composer require daryledesilva/markdown-to-mrkdwn-php
```

🚀 Usage
-------

[](#-usage)

```
use DaryleDeSilva\MarkdownToMrkdwn\Converter;

$converter = new Converter();
echo $converter->convert("**Hello**, [Slack](https://slack.com)!");
```

🧪 Testing
---------

[](#-testing)

```
composer install
composer test
```

🔗 Testing in Slack
------------------

[](#-testing-in-slack)

You can preview the converted mrkdwn in Slack’s Block Kit Builder:

📄 License
---------

[](#-license)

MIT

---

Inspired by the original Python package [markdown\_to\_mrkdwn](https://github.com/fla9ua/markdown_to_mrkdwn).

Created by [@daryledesilva](https://github.com/daryledesilva)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance52

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Total

3

Last Release

339d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4393436?v=4)[Daryle Dale De Silva](/maintainers/daryledesilva)[@daryledesilva](https://github.com/daryledesilva)

---

Top Contributors

[![daryledesilva](https://avatars.githubusercontent.com/u/4393436?v=4)](https://github.com/daryledesilva "daryledesilva (21 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/daryledesilva-markdown-to-mrkdwn-php/health.svg)

```
[![Health](https://phpackages.com/badges/daryledesilva-markdown-to-mrkdwn-php/health.svg)](https://phpackages.com/packages/daryledesilva-markdown-to-mrkdwn-php)
```

###  Alternatives

[breadlesscode/neos-nodetypes-folder

Folder nodetype for Neos CMS

1088.5k1](/packages/breadlesscode-neos-nodetypes-folder)

PHPackages © 2026

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