Download the PHP package blockshiftnetwork/chat-markdown-converter without Composer

On this page you can find all versions of the php package blockshiftnetwork/chat-markdown-converter. 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 chat-markdown-converter

Chat Markdown Converter

Latest Version on Packagist Tests Total Downloads

Convert AI-generated Markdown to WhatsApp, Telegram, Discord, Slack and Instagram formats using an Intermediate Representation (IR). Perfect for converting LLM responses to chat-friendly formats.

This PHP library transforms ChatGPT, Claude, GPT-5, and other AI model outputs into platform-specific markup. It handles code blocks, tables, lists, links, and rich text formatting while maintaining readability across all supported platforms.

Features

Use Cases

AI Chatbots & Virtual Assistants

Send formatted responses from OpenAI, Anthropic, or other LLM APIs directly to users via their preferred messaging platform. Ensure code blocks, tables, and lists render correctly across Telegram, WhatsApp, Discord, Slack, and Instagram.

Customer Support Automation

Automate support workflows by converting AI-generated help articles and documentation into chat-friendly formats. Preserve formatting while delivering concise, readable responses in your customers' channels.

Developer Tools & DevOps

Integrate with CI/CD pipelines, monitoring systems, or alerting platforms to send formatted logs, error messages, or status updates to team channels. Convert Markdown reports to platform-appropriate syntax automatically.

Content Distribution Systems

Distribute newsletters, summaries, or generated content across multiple platforms simultaneously. Write once in Markdown and automatically convert to Telegram HTML, WhatsApp text, Discord markdown, Slack mrkdwn, or Instagram-ready Unicode captions.

Educational Platforms

Convert AI-generated tutorials, code examples, and learning materials into appropriate formats for students across different communication channels. Keep code snippets and syntax highlighting functional.

Knowledge Base Integration

Transform documentation and wiki content from Markdown sources into chat-appropriate formats for quick distribution via messaging apps. Maintain structure and readability without manual reformatting.

Notification Systems

Build notification services that send formatted alerts, summaries, and reports from AI analysis tools. Convert complex data presentations into simple, readable messages on any platform.

Laravel Applications

Use the package inside Laravel jobs, notifications, controllers, or queued bot handlers when an application needs to deliver AI-generated Markdown through chat channels without manually rewriting the same response for each platform.

Multi-Platform Content Management

Manage content in a single Markdown format while automatically adapting output for different chat platforms' unique formatting requirements and limitations.

Internal Communication Tools

Streamline internal updates, announcements, and reports by converting Markdown-based company communications to team messaging platforms with proper formatting.

Installation

You can install the package via composer:

Why Choose This Library?

Platform-Aware Formatting

Unlike naive Markdown-to-text converters, this library understands each platform's unique limitations and formatting rules. Telegram uses HTML tags, WhatsApp uses asterisk-based formatting, Discord and Slack have their own markdown variants, and Instagram requires Unicode Mathematical Alphanumeric Symbols since it has no native markup at all - we handle all these differences automatically.

Intermediate Representation Architecture

By parsing Markdown into an abstract IR first, we ensure consistent behavior across all platforms. This clean architecture makes it easy to add new platforms or customize rendering logic without modifying the core parser.

Intelligent Feature Adaptation

Automatically converts complex Markdown features to platform-compatible formats:

Production-Ready Reliability

Comprehensive test coverage (200+ tests) ensures consistent behavior across edge cases. Handle special characters, nested formatting, mixed content types, and Unicode/emoji support with confidence.

Developer Experience

Simple, intuitive API with fluent method chaining. Convert in one line with static methods or take full control with the flexible parser options. Zero learning curve for Markdown developers.

Performance Optimized

Lightweight implementation with no external dependencies. Fast parsing and rendering suitable for high-volume applications and real-time chat systems.

AI-Response Ready

Specifically designed for LLM outputs that often include code blocks, tables, lists, and mixed formatting. Preserve the intelligence of AI responses while making them platform-appropriate.

Open Source & Extensible

MIT license, active development, and contribution-friendly architecture. Easily create custom renderers for proprietary platforms or specialized use cases.

Alternative Approaches

Direct Markdown-to-Text Conversion

Simple converters often strip all formatting or produce unreadable output. Our platform-specific renderers preserve structure and readability while respecting each platform's formatting capabilities.

Multiple Separate Libraries

Using different libraries for each platform adds complexity and dependencies. Our unified solution provides consistent behavior across all platforms with a single, well-tested codebase.

Manual Reformatting

Manually writing separate responses for each platform is time-consuming and error-prone. Automate with our converter and maintain content consistency while reaching users everywhere.

Regular Expression Replacements

Naive regex-based converters fail with nested formatting, special characters, and complex structures. Our parser handles all edge cases correctly with proper state management.

Usage

Quick Conversion

In a Laravel Notification or Job

Fluent API

With Message Chunking

Custom Renderer

Parser Options

Supported Features

Currently Supported

Platform-Specific Features

Telegram (HTML Mode)

WhatsApp

Discord

Slack

Instagram

Instagram has no native rich-text formatting in any surface (captions, bios, comments, DMs, story overlays, Reels descriptions). The renderer substitutes ASCII letters and digits with characters from Unicode's Mathematical Alphanumeric Symbols block so the output renders with the expected visual weight when pasted into Instagram.

Accessibility note: Mathematical Alphanumeric Symbols are read as separate, decontextualized characters by screen readers (e.g. 𝗯𝗼𝗹𝗱 is announced as "Mathematical Sans-Serif Bold B, Mathematical Sans-Serif Bold O…"). When accessibility matters more than visual emphasis, post the original Markdown body without running it through the Instagram renderer.

Roadmap

Completed

Planned

Platform Comparison

Feature Telegram WhatsApp Discord Slack Instagram
Format Type HTML Text Markdown mrkdwn Unicode plain text
Bold <b> *text* **text** *text* Unicode sans-serif bold
Italic <i> _text_ *text* _text_ Unicode sans-serif italic
Code <code> ` | ` | ` Unicode monospace
Code Blocks <pre> Triple backticks Triple backticks Triple backticks Monospace + ━ rules
Strikethrough <s> ~text~ ~~text~~ ~text~ Combining U+0336
Links <a href> text: url [text](url) <url\|text> text: url
Tables Not supported Not supported Native support Not supported Not supported
Max Message Length 4096 chars 4096 chars 2000 chars 40000 chars 2200 chars (caption)

Testing

Current Test Status: 206 passed, 1 skipped

Architecture

The package uses an Intermediate Representation (IR) pattern:

Components

Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

Development Setup

Credits

FAQ

Why use an Intermediate Representation instead of direct conversion?

The IR pattern provides better separation of concerns and extensibility. Parse once, render many times. This makes it easy to add new platforms without modifying the parser logic, and ensures consistent behavior across all renderers.

Can I customize the rendering behavior?

Yes! Extend the AbstractRenderer class to create custom renderers. The parser provides a structured IR that you can transform into any format you need.

How does table conversion work?

For platforms without native table support (Telegram, WhatsApp, Slack, Instagram), tables are automatically converted to hierarchical bullet lists, preserving the structure and readability.

Does this library support all Markdown features?

We support the most common Markdown features used in AI responses: headings, code blocks, lists, links, images, blockquotes, horizontal rules, and text formatting. See the Supported Features section for details.

What about message length limits?

The TextChunker intelligently splits long messages at safe breakpoints (after sentences, paragraphs, or list items) while preserving formatting and avoiding broken markup. To land on a clean breakpoint, a chunk may exceed the requested maxLength by up to 50 characters; budget for that overshoot when choosing your limit (e.g. pass maxLength: 4046 if you absolutely must stay under Telegram's 4096-char hard cap).

Can I use this with any PHP version?

This library requires PHP 8.3 or higher, taking advantage of modern PHP features like match expressions and readonly properties.

Is this suitable for production use?

Yes! The library has comprehensive test coverage (200+ tests) and is actively maintained. It's designed for performance and reliability in production environments.

Optimization Tips

License

The MIT License (MIT). Please see License File for more information.


All versions of chat-markdown-converter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 blockshiftnetwork/chat-markdown-converter contains the following files

Loading the files please wait ...