https://github.com/wpsocio/telegram-format-text
Production Repository | HTML to Text converter/formatter for Telegram Bot API. Development takes place in our monorepo - https://github.com/wpsocio/wp-projects/tree/main/packages/php/telegram-format-text
https://github.com/wpsocio/telegram-format-text
formatter html telegram text
Last synced: 4 months ago
JSON representation
Production Repository | HTML to Text converter/formatter for Telegram Bot API. Development takes place in our monorepo - https://github.com/wpsocio/wp-projects/tree/main/packages/php/telegram-format-text
- Host: GitHub
- URL: https://github.com/wpsocio/telegram-format-text
- Owner: wpsocio
- License: gpl-3.0
- Created: 2024-01-24T10:16:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-30T09:47:47.000Z (11 months ago)
- Last Synced: 2025-09-22T20:40:33.370Z (9 months ago)
- Topics: formatter, html, telegram, text
- Language: PHP
- Homepage: https://packagist.org/packages/wpsocio/telegram-format-text
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WPSocio\TelegramFormatText
HTML to Text converter/formatter for [Telegram Bot API](https://core.telegram.org/bots/api#formatting-options)
Inspired by [thephpleague/html-to-markdown](https://github.com/thephpleague/html-to-markdown).
## Usage
```bash
composer require wpsocio/telegram-format-text
```
```php
require_once __DIR__ . '/autoload.php';
$html = 'Some html here';
$options = [
'format_to' => 'Markdown',
];
$converter = new \WPSocio\TelegramFormatText\HtmlConverter( $options );
// The text is now safe to be sent to Telegram
$text = $converter->convert( $html );
```
## Requirements
- `PHP >= 8.0`