Skip to content

tioffs/fentities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram formate message entities html License

Downloads Telegram

Installation

Using Composer:

composer require tioffs/fentities

Supports entities

  • messageEntityItalic
  • messageEntityBold
  • messageEntityCode
  • messageEntityPre
  • messageEntityStrike
  • messageEntityUnderline
  • messageEntityBlockquote
  • messageEntityTextUrl
  • messageEntityMention
  • messageEntityUrl

Example

$message  = [
                "_" => "message",
                "out" => false,
                "mentioned" => false,
                "media_unread" => false,
                "silent" => true,
                "post" => true,
                "from_scheduled" => false,
                "legacy" => false,
                "id" => 83943,
                "to_id" => [
                    "_" => "peerChannel",
                    "channel_id" => 123456789
                ],
                "date" => 1565361063,
                "message" => "PHP is a popular general-purpose scripting language that is especially suited to web development. http://php.net",
                "media" => [],
                "entities" => [
                    [
                        "_" => "messageEntityBold",
                        "offset" => 0,
                        "length" => 96
                    ],
                    [
                        "_" => "messageEntityUrl",
                        "offset" => 98,
                        "length" => 14
                    ]
                ],
                "views" => 34566
            ];

require_once 'vendor/autoload.php';
$text = Formats\Message::html($message);

Result

<b>PHP is a popular general-purpose scripting language that
is especially suited to web development.</b>
<a href="http://php.net">http://php.net</a>

Made with ♥ from the @tioffs