PhpBotFramework  1.0.0
A framework for Telegram Bots' APIs.
Functions
Utility methods

Helper methods. More...

Functions

static DanySpin97\PhpBotFramework\Utility::getHashtags (string $string)
 Get hashtag contained in a string. More...
 
static DanySpin97\PhpBotFramework\Utility::removeUsernameFormattation (string $string, string $tag)
 Remove html formattation from telegram usernames in string. More...
 

Detailed Description

Helper methods.

Function Documentation

§ getHashtags()

static DanySpin97\PhpBotFramework\Utility::getHashtags ( string  $string)
static

Get hashtag contained in a string.

Check hashtags in a string using regex. All valid hashtags will be returned in an array. Credis to trante.

Parameters
$stringThe string to check for hashtags.
Returns
An array of valid hashtags, can be empty.

§ removeUsernameFormattation()

static DanySpin97\PhpBotFramework\Utility::removeUsernameFormattation ( string  $string,
string  $tag 
)
static

Remove html formattation from telegram usernames in string.

Remove the $modificator html formattation from a message containing telegram username, to let the user click them.

Parameters
$stringto parse.
$tagFormattation tag to remove.
Returns
The string, modified if there are usernames. Otherwise $string.