PHP Class Telegram\Bot\Keyboard\Keyboard

For Standard Keyboard $params = [ 'keyboard' => '', 'resize_keyboard' => '', 'one_time_keyboard' => '', 'selective' => '', ]; OR For Inline Keyboard $params = [ 'inline_keyboard' => '', ];
Inheritance: extends Base
Show file Open project: irazasyed/telegram-bot-sdk Class Usage Examples

Protected Properties

Property Type Description
$inline boolean Make an Inline Keyboard

Public Methods

Method Description
button ( string | array $params = [] ) : mixed Represents one button of the Reply keyboard.
forceReply ( array $params = [] ) : string Display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply').
hide ( array $params = [] ) : string Hide the current custom keyboard and display the default letter-keyboard.
inline ( ) Make this keyboard inline, So it appears right next to the message it belongs to.
inlineButton ( string | array $params = [] ) : string Represents one button of an inline keyboard.
isInlineKeyboard ( ) : boolean Determine if it's an inline keyboard.
row ( ) Create a new row in keyboard to add buttons.

Method Details

button() public static method

For simple text buttons String can be used instead of an array. You can also utilise the fluent API to build the params payload. $params = 'string' OR $params = [ 'text' => '', 'request_contact' => '', 'request_location' => '', ];
public static button ( string | array $params = [] ) : mixed
$params string | array
return mixed

forceReply() public static method

$params = [ 'force_reply' => true, 'selective' => false, ];
public static forceReply ( array $params = [] ) : string
$params array
return string

hide() public static method

$params = [ 'hide_keyboard' => true, 'selective' => false, ];
public static hide ( array $params = [] ) : string
$params array
return string

inline() public method

Make this keyboard inline, So it appears right next to the message it belongs to.
public inline ( )

inlineButton() public static method

You must use exactly one of the optional fields. You can also utilise the fluent API to build the params payload. $params = [ 'text' => '', 'url' => '', 'callback_data' => '', 'switch_inline_query' => '', ];
public static inlineButton ( string | array $params = [] ) : string
$params string | array
return string

isInlineKeyboard() public method

Determine if it's an inline keyboard.
public isInlineKeyboard ( ) : boolean
return boolean

row() public method

Create a new row in keyboard to add buttons.
public row ( )

Property Details

$inline protected property

Make an Inline Keyboard
protected bool $inline
return boolean