wptelegram / format-text
HTML to Text converter/formatter for Telegram Bot API
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:HTML
Requires (Dev)
- pestphp/pest: ^1.22
- squizlabs/php_codesniffer: ^3.7
- wp-coding-standards/wpcs: ^3.0.1
- z4kn4fein/php-semver: ^2.0
README
HTML to Text converter/formatter for Telegram Bot API
Inspired by thephpleague/html-to-markdown.
Abandonned!
Please use wpsocio/telegram-format-text
Usage
composer require wptelegram/format-text
require_once __DIR__ . '/autoload-static.php'; // Or this for usage in WordPress require_once __DIR__ . '/autoload-wp.php'; $html = 'Some html here'; $options = [ 'format_to' => 'Markdown', ]; $converter = new \WPTelegram\FormatText\HtmlConverter( $options ); // The text is now safe to be sent to Telegram $text = $converter->convert( $html );
NOTES:
- Do not require conditionally, like
if ( class_exists() )
. - It's safe to include it directly.
- Library takes care of its multiple versions being loaded.
- It always loads the latest version.
Requirements
PHP >= 7.0