use Longman\TelegramBot\Entities\Keyboard;
...
(new Keyboard([
['text' => "REGISTRATION", 'request_contact' => true]
]))->setOneTimeKeyboard(false)->setResizeKeyboard(true)->setSelective(true)
class SystemCommand extends GenericmessageCommand
{
public function execute()
{
$chat_id = $this->getMessage()->getFrom()->getId();
// if the passed phone
$contact = $this->getMessage()->getContact();
if (is_object($contact)) {
$contact ID = $contact->getUserId();
if ($chat_id == $contact ID) {
// alas, the more authentic I can not check that the sender's phone
$phone = $contact->getPhoneNumber();
}
}
}
}
Find more questions by tags Telegram