Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4c6e854
Add `supportsGuestQueries` field to `User` type.
vjik May 9, 2026
42b56eb
Add `guestQueryId`, `guestBotCallerUser` and `guestBotCallerChat` fie…
vjik May 9, 2026
a2dfb62
Add `guestMessage` field to `Update` type
vjik May 9, 2026
af862fa
Add `SentGuestMessage` type
vjik May 9, 2026
b71acc3
Add `AnswerGuestQuery` method
vjik May 9, 2026
0dee8c0
Add `canReactToMessages` field to `ChatMemberRestricted` and `ChatPer…
vjik May 9, 2026
46e1412
Add `returnBots` parameter to `GetChatAdministrators` method
vjik May 9, 2026
8774b6e
Add `DeleteAllMessageReactions` method
vjik May 9, 2026
1880baf
Add `DeleteMessageReaction` method
vjik May 9, 2026
053de25
Add `InputMediaSticker`, `InputMediaVenue` and `InputMediaLocation` t…
vjik May 9, 2026
bf5eed9
Add `PollMedia` and `LivePhoto` type
vjik May 9, 2026
585408d
Add `explanationMedia` and `media` fields to `Poll` type
vjik May 9, 2026
01a5a4e
Add `membersOnly` and `countryCodes` fields to `Poll` type
vjik May 9, 2026
46d1210
Add `media` field to `PollOption` type
vjik May 9, 2026
fa643ea
Add `InputPollMedia` and `InputPollOptionMedia` types
vjik May 9, 2026
d0fb5d7
Fix psalm
vjik May 9, 2026
a1242c5
Add `explanationMedia`, `media`, `membersOnly` and `countryCodes` par…
vjik May 9, 2026
7821d64
Add `media` field to `InputPollOption` type
vjik May 9, 2026
1a171fe
Add `InputMediaLivePhoto` type
vjik May 9, 2026
0ebff89
Add `live_photo` field to `Message` and `ExternalReplyInfo` types
vjik May 9, 2026
fa0aa3e
Add `SendLivePhoto` method
vjik May 9, 2026
49f8451
Add `PaidMediaLivePhoto` type
vjik May 9, 2026
b9967ff
Add `InputPaidMediaLivePhoto` type
vjik May 9, 2026
dea8809
`SendMediaGroup` method now supports `InputMediaLivePhoto` type
vjik May 9, 2026
68f7cb9
Add `BotAccessSettings` type
vjik May 9, 2026
4edb58a
Add `GetManagedBotAccessSettings` method
vjik May 9, 2026
5b4094d
Add `SetManagedBotAccessSettings` method
vjik May 9, 2026
a2d582e
Add `GetUserPersonalChatMessages` method
vjik May 9, 2026
6d2cf40
fix
vjik May 9, 2026
1ec3090
fix
vjik May 9, 2026
7cad54b
`text` parameter in `SendMessageDraft` method is now optional
vjik May 9, 2026
20761df
readme
vjik May 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Agent Guidelines

## Writing Tests

- For `InputFile|string` parameters, the string must be a file ID, not a URL.
Comment thread
vjik marked this conversation as resolved.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Telegram Bot API for PHP Change Log

## 0.21 May 9, 2026

- New #199: Add `supportsGuestQueries` field to `User` type.
- New #199: Add `guestQueryId`, `guestBotCallerUser` and `guestBotCallerChat` fields to `Message` type.
- New #199: Add `guestMessage` field to `Update` type.
- New #199: Add `SentGuestMessage` type.
- New #199: Add `AnswerGuestQuery` method.
- New #199: Add `canReactToMessages` field to `ChatMemberRestricted` and `ChatPermissions` types.
- New #199: Add `returnBots` parameter to `GetChatAdministrators` method.
- New #199: Add `DeleteAllMessageReactions` method.
- New #199: Add `DeleteMessageReaction` method.
- New #199: Add `InputMediaSticker`, `InputMediaVenue`, `InputMediaLocation` and `InputMediaLivePhoto` types.
- New #199: Add `PollMedia` and `LivePhoto` type.
- New #199: Add `explanationMedia`, `media`, `membersOnly` and `countryCodes` fields to `Poll` type.
- New #199: Add `media` field to `PollOption` type.
- New #199: Add `InputPollMedia` and `InputPollOptionMedia` types.
- New #199: Add `live_photo` field to `Message` and `ExternalReplyInfo` types.
- New #199: Add `SendLivePhoto` method.
- New #199: Add `PaidMediaLivePhoto` type.
- New #199: Add `InputPaidMediaLivePhoto` type.
- New #199: Add `explanationMedia`, `media`, `membersOnly` and `countryCodes` parameters to `SendPoll` method.
- New #199: Add `media` field to `InputPollOption` type.
- Enh #199: `SendMediaGroup` method now supports `InputMediaLivePhoto` type.
- New #199: Add `BotAccessSettings` type.
- New #199: Add `GetManagedBotAccessSettings` method.
- New #199: Add `SetManagedBotAccessSettings` method.
- New #199: Add `GetUserPersonalChatMessages` method.
- Chg #199: `text` parameter in `SendMessageDraft` method is now optional.

## 0.20 April 26, 2026

- Chg #197: `$data` parameter type in `TransportInterface::postWithFiles()` changed from `array<string, scalar>`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

The package provides a simple and convenient way to interact with the Telegram Bot API.

✔️ Telegram Bot API 9.6 (April 3, 2026) is **fully supported**.
✔️ Telegram Bot API 10.0 (May 8, 2026) is **fully supported**.

♻️ **Zero dependencies** — no third-party libraries, only native PHP.

Expand Down
50 changes: 50 additions & 0 deletions src/Method/DeleteAllMessageReactions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

namespace Phptg\BotApi\Method;

use Phptg\BotApi\ParseResult\ValueProcessor\TrueValue;
use Phptg\BotApi\Transport\HttpMethod;
use Phptg\BotApi\MethodInterface;

/**
* @see https://core.telegram.org/bots/api#deleteallmessagereactions
*
* @template-implements MethodInterface<true>
*/
final readonly class DeleteAllMessageReactions implements MethodInterface
{
public function __construct(
private int|string $chatId,
private ?int $userId = null,
private ?int $actorChatId = null,
) {}

public function getHttpMethod(): HttpMethod
{
return HttpMethod::POST;
}

public function getApiMethod(): string
{
return 'deleteAllMessageReactions';
}

public function getData(): array
{
return array_filter(
[
'chat_id' => $this->chatId,
'user_id' => $this->userId,
'actor_chat_id' => $this->actorChatId,
],
static fn(mixed $value): bool => $value !== null,
);
}

public function getResultType(): TrueValue
{
return new TrueValue();
}
}
52 changes: 52 additions & 0 deletions src/Method/DeleteMessageReaction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

namespace Phptg\BotApi\Method;

use Phptg\BotApi\ParseResult\ValueProcessor\TrueValue;
use Phptg\BotApi\Transport\HttpMethod;
use Phptg\BotApi\MethodInterface;

/**
* @see https://core.telegram.org/bots/api#deletemessagereaction
*
* @template-implements MethodInterface<true>
*/
final readonly class DeleteMessageReaction implements MethodInterface
{
public function __construct(
private int|string $chatId,
private int $messageId,
private ?int $userId = null,
private ?int $actorChatId = null,
) {}

public function getHttpMethod(): HttpMethod
{
return HttpMethod::POST;
}

public function getApiMethod(): string
{
return 'deleteMessageReaction';
}

public function getData(): array
{
return array_filter(
[
'chat_id' => $this->chatId,
'message_id' => $this->messageId,
'user_id' => $this->userId,
'actor_chat_id' => $this->actorChatId,
],
static fn(mixed $value): bool => $value !== null,
);
}

public function getResultType(): TrueValue
{
return new TrueValue();
}
}
9 changes: 8 additions & 1 deletion src/Method/GetChatAdministrators.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{
public function __construct(
private int|string $chatId,
private ?bool $returnBots = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -33,7 +34,13 @@ public function getApiMethod(): string

public function getData(): array
{
return ['chat_id' => $this->chatId];
return array_filter(
[
'chat_id' => $this->chatId,
'return_bots' => $this->returnBots,
],
static fn(mixed $value): bool => $value !== null,
);
}

public function getResultType(): ArrayMap
Expand Down
42 changes: 42 additions & 0 deletions src/Method/GetManagedBotAccessSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace Phptg\BotApi\Method;

use Phptg\BotApi\ParseResult\ValueProcessor\ObjectValue;
use Phptg\BotApi\Transport\HttpMethod;
use Phptg\BotApi\MethodInterface;
use Phptg\BotApi\Type\BotAccessSettings;

/**
* @see https://core.telegram.org/bots/api#getmanagedbotaccesssettings
*
* @template-implements MethodInterface<BotAccessSettings>
*/
final readonly class GetManagedBotAccessSettings implements MethodInterface
{
public function __construct(
private int $userId,
) {}

public function getHttpMethod(): HttpMethod
{
return HttpMethod::GET;
}

public function getApiMethod(): string
{
return 'getManagedBotAccessSettings';
}

public function getData(): array
{
return ['user_id' => $this->userId];
}

public function getResultType(): ObjectValue
{
return new ObjectValue(BotAccessSettings::class);
}
}
46 changes: 46 additions & 0 deletions src/Method/GetUserPersonalChatMessages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Phptg\BotApi\Method;

use Phptg\BotApi\ParseResult\ValueProcessor\ArrayOfObjectsValue;
use Phptg\BotApi\Transport\HttpMethod;
use Phptg\BotApi\MethodInterface;
use Phptg\BotApi\Type\Message;

/**
* @see https://core.telegram.org/bots/api#getuserpersonalchatmessages
*
* @template-implements MethodInterface<array<Message>>
*/
final readonly class GetUserPersonalChatMessages implements MethodInterface
{
public function __construct(
private int $userId,
private int $limit,
) {}

public function getHttpMethod(): HttpMethod
{
return HttpMethod::GET;
}

public function getApiMethod(): string
{
return 'getUserPersonalChatMessages';
}

public function getData(): array
{
return [
'user_id' => $this->userId,
'limit' => $this->limit,
];
}

public function getResultType(): ArrayOfObjectsValue
{
return new ArrayOfObjectsValue(Message::class);
}
}
47 changes: 47 additions & 0 deletions src/Method/Inline/AnswerGuestQuery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

namespace Phptg\BotApi\Method\Inline;

use Phptg\BotApi\ParseResult\ValueProcessor\ObjectValue;
use Phptg\BotApi\Transport\HttpMethod;
use Phptg\BotApi\MethodInterface;
use Phptg\BotApi\Type\Inline\InlineQueryResult;
use Phptg\BotApi\Type\SentGuestMessage;

/**
* @see https://core.telegram.org/bots/api#answerguestquery
*
* @template-implements MethodInterface<SentGuestMessage>
*/
final readonly class AnswerGuestQuery implements MethodInterface
{
public function __construct(
private string $guestQueryId,
private InlineQueryResult $result,
) {}

public function getHttpMethod(): HttpMethod
{
return HttpMethod::POST;
}

public function getApiMethod(): string
{
return 'answerGuestQuery';
}

public function getData(): array
{
return [
'guest_query_id' => $this->guestQueryId,
'result' => $this->result->toRequestArray(),
];
}

public function getResultType(): ObjectValue
{
return new ObjectValue(SentGuestMessage::class);
}
}
Loading
Loading