PHPackages                             asokol1981/telegram-entities-html - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. asokol1981/telegram-entities-html

ActiveProject[Queues &amp; Workers](/categories/queues)

asokol1981/telegram-entities-html
=================================

Renders Telegram message entities into HTML

v1.0.4(11mo ago)046MITPHPPHP &gt;=8.1CI passing

Since May 25Pushed 11mo agoCompare

[ Source](https://github.com/asokol1981/telegram-entities-html)[ Packagist](https://packagist.org/packages/asokol1981/telegram-entities-html)[ RSS](/packages/asokol1981-telegram-entities-html/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

Telegram Entities HTML Renderer
===============================

[](#telegram-entities-html-renderer)

[![tests](https://github.com/asokol1981/telegram-entities-html/workflows/tests/badge.svg)](https://github.com/asokol1981/telegram-entities-html/actions) [![codecov](https://camo.githubusercontent.com/7397737be3437e7274b0f8e5a4939f0aa6d707397171eb4a8237ee2879e3e70a/68747470733a2f2f636f6465636f762e696f2f67682f61736f6b6f6c313938312f74656c656772616d2d656e7469746965732d68746d6c2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/asokol1981/telegram-entities-html) [![downloads](https://camo.githubusercontent.com/4cdff3fdf1cab4399ecc1c849fd724f5f1166137bd01904bd18196c6676defb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736f6b6f6c313938312f74656c656772616d2d656e7469746965732d68746d6c2e737667)](https://packagist.org/packages/asokol1981/telegram-entities-html)

📦 Turn Telegram message entities into HTML with ease.

---

Features
--------

[](#features)

- Converts `text` and `caption` with `entities` or `caption_entities` to HTML
- Supports all Telegram formatting types (bold, italic, code, etc.)
- Outputs safe and valid HTML, suitable for web rendering
- Written in modern PHP

---

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require asokol1981/telegram-entities-html
```

### VCS

[](#vcs)

If the package is not available on Packagist, you can install it by adding the following to your `composer.json`:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/asokol1981/telegram-entities-html"
    }
  ],
  "require": {
    "asokol1981/telegram-entities-html": "dev-main"
  }
}
```

Then run:

```
composer update
```

⚠️ Make sure your project allows the dev-main version or use a specific tag (e.g. ^1.0) once available.

Usage
-----

[](#usage)

```
use ASokol1981\Telegram\Entities\Html\Renderer;

$renderer = new Renderer();

$html = $renderer->render(
    '😎 Text message with bold and italic',
    [
        ['type' => 'bold', 'offset' => 21, 'length' => 4],
        ['type' => 'italic', 'offset' => 30, 'length' => 6],
    ]
);

echo $html; // 😎 Text message with bold and italic
```

Works with both `text` + `entities` and `caption` + `caption_entities`.

Supported entity types:

- bold
- italic
- underline
- strikethrough
- spoiler
- blockquote
- expandable\_blockquote
- code
- pre
- text\_link
- text\_mention
- custom\_emoji

🛠️ Makefile Commands
--------------------

[](#️-makefile-commands)

To simplify local development, the following `make` commands are available:

### 📦 Installation

[](#-installation)

```
make install
```

Builds the Docker container, starts it in the background, and installs Composer dependencies.

---

### 🏗️ Build Image

[](#️-build-image)

```
make build
```

Builds the Docker image with the tag `asokol1981/telegram-entities-html`.

---

### ▶️ Start Container

[](#️-start-container)

```
make start
```

Starts the container in detached mode.

---

### ⏹️ Stop Container

[](#️-stop-container)

```
make stop
```

Stops and removes the container (volumes are preserved).

---

### 🧹 Uninstall

[](#-uninstall)

```
make uninstall
```

Stops and removes the container, associated volumes, and the Docker image.

---

### 🐚 Shell Access

[](#-shell-access)

```
make exec -- bash
```

Runs a command inside the container. Be sure to use `--` to separate `make` arguments from the actual command:

```
make exec -- php -v
```

---

### 🎼 Composer

[](#-composer)

```
make composer -- require --dev phpunit/phpunit
```

Executes a Composer command inside the container. Example: install PHPUnit as a dev dependency.

---

### ✅ Run Tests

[](#-run-tests)

```
make test
```

Runs tests and shows code coverage summary in the terminal.

---

### 📊 HTML Coverage Report

[](#-html-coverage-report)

```
make coverage
```

Generates a code coverage report in HTML format and saves it in the `coverage/` directory.

---

### 🧱 Artisan

[](#-artisan)

```
make artisan -- list
```

Executes an Artisan command inside the container.

---

### 🧹 Code Style Fix

[](#-code-style-fix)

```
make php-cs-fixer
```

Runs PHP-CS-Fixer inside the container to automatically fix coding style issues according to the defined `.php-cs-fixer.dist.php` configuration.

---

### ✅ Validate Codecov Configuration

[](#-validate-codecov-configuration)

You can validate `codecov.yml` configuration using:

```
make codecov-validate
```

This command checks the syntax and structure of the `codecov.yml` file using Codecov’s validation API. It helps catch errors before pushing changes.

---

**ℹ️ Note:**When passing arguments to `exec`, `composer`, `artisan`, `test`, or `coverage` targets, **always prefix them with `--`** so `make` doesn't interpret them as its own flags.

License
-------

[](#license)

MIT © [asokol1981](https://github.com/asokol1981)

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance54

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

5

Last Release

348d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad41638a3dc08f6fc7d239a3e6744c9837fc60718c48e2e775f4cf2e26799bba?d=identicon)[asokol1981](/maintainers/asokol1981)

---

Top Contributors

[![asokol1981](https://avatars.githubusercontent.com/u/11194728?v=4)](https://github.com/asokol1981 "asokol1981 (23 commits)")

---

Tags

messagephphtmltelegramentities

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/asokol1981-telegram-entities-html/health.svg)

```
[![Health](https://phpackages.com/badges/asokol1981-telegram-entities-html/health.svg)](https://phpackages.com/packages/asokol1981-telegram-entities-html)
```

###  Alternatives

[nahid/talk

Talk is a Laravel based realtime messaging, chatting and conversation system. It helps to develop users messaging, chatting and conversations in easy way.

1.6k58.1k4](/packages/nahid-talk)[baklysystems/laravel-chat-messenger

Laravel chat package

121.8k](/packages/baklysystems-laravel-chat-messenger)

PHPackages © 2026

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