An open API service indexing awesome lists of open source software.

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

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`