Releases: mammothcoding/maxoxide_php
v2.0.0
EN
Release summary
This release updates maxoxide-php for the current public MAX REST API, adds convenience helpers for media sending, makes update parsing more forward-compatible, and expands the dispatcher into a more practical routing layer.
Breaking changes
Update::$timestampis now nullable because unknown future updates may omit a timestamp.- Use
Update::timestampOrDefault()when the previous0fallback behavior is desired. - Plain text should be represented by leaving
NewMessageBody::$formatunset.MessageFormatnow exposes only documented MAX format values:MARKDOWNandHTML. - Code that constructs raw
Buttonobjects foropen_appshould migrate toButton::openApp(),Button::openAppWithPayload(), orButton::openAppFull(), which serialize the official MAX wire model withweb_app, optionalpayload, and optionalcontact_id.
User::$name and ChatMember::$name remain available as legacy aliases in PHP, but new code should prefer firstName, lastName, and displayName().
Added
- Added typed fallback support for unknown
Updateand unknown attachments, preserving raw JSON for later inspection. - Added attachment deserialization for both wrapped
payloadobjects and flat attachment objects, soButton::requestGeoLocation()updates can deserialize asAttachmentKind::LOCATIONwithlatitudeandlongitude. - Added typed string value classes:
ChatTypeChatStatusMessageFormatButtonIntentLinkTypeAttachmentKindChatAdminPermissionSenderAction
- Added more complete MAX models for users, chats, members, admins, video metadata, image/photo payloads, upload endpoints, upload responses, and webhook subscriptions.
- Added current MAX profile fields to
UserandChatMember:firstNamelastNameusernamedescriptionavatarUrlfullAvatarUrlcommands, where available
- Added
Button::openApp(),Button::openAppWithPayload(), andButton::openAppFull()using the officialweb_app,payload, andcontact_idfields. - Added
Button::clipboard(). - Added builders and helpers for outgoing messages and attachments:
NewMessageBody::empty()NewMessageBody::textOpt()NewMessageBody::withAttachments()NewMessageBody::withReplyTo()NewMessageBody::withForwardFrom()NewMessageBody::withNotify()NewAttachment::imageUrl()NewAttachment::imagePhotos()NewAttachment::imagePayload()
- Added
SendMessageOptionswithdisable_link_preview. - Added message, video, member, and admin endpoints:
sendMessageToChatWithOptions()sendMessageToUserWithOptions()getMessagesByIds()getVideo()getMembersByIds()addAdmins()removeAdmin()
- Added typed sender action methods:
sendSenderAction()sendTypingOn()sendSendingImage()sendSendingVideo()sendSendingAudio()sendSendingFile()markSeen()
- Added upload-and-send helpers for both chat and user recipients:
sendImageToChat()/sendImageToUser()sendVideoToChat()/sendVideoToUser()sendAudioToChat()/sendAudioToUser()sendFileToChat()/sendFileToUser()- byte-based variants for the same media types
- Added
Bot::getUpdatesRaw()andRawUpdatesResponsefor raw polling before typed parsing. - Added
Dispatcher::onUpdate(), composableFiltervalues, regex text filters, media/file attachment filters,onStart(),task(),onRawUpdate(), and raw dispatch viadispatchRaw(). - Added
examples/media_bot.phpandexamples/dispatcher_filters_bot.php.
Changed
getUploadUrl()now returns anUploadEndpointobject and serializes upload types using documented lowercase wire values.- Long polling now receives raw update JSON first, then dispatches through raw and typed handlers.
- Webhook handling now dispatches raw JSON through the same dispatcher path as long polling.
- Upload helpers now accept attachment tokens from either the upload endpoint response or multipart upload response, preserve the MAX
photostoken map for image send helpers, and retry briefly while MAX reports an uploaded attachment as not processed yet. uploadFile()anduploadBytes()still return a simple token string for existing callers, but image uploads can now also be represented asImageAttachmentPayloadwhen using send helpers.- README examples now use the newer builders, dispatcher filters, typed sender actions, and media helpers.
examples/live_api_test.phpnow covers the expanded PHP API, including raw updates, message options, media helpers,getVideo(), member/admin helpers, typed sender actions,open_app, andclipboard.
Fixed
- Fixed Composer autoloading for aggregate source files such as
src/Types.phpandsrc/Dispatcher.php, sovendor/autoload.phpnow loads classes likeMaxoxide\User,Maxoxide\Update, andMaxoxide\Filterwithout requiringbootstrap.php. bootstrap.phpnow usesrequire_once, so it remains compatible with Composer autoload and older direct source-tree workflows.- Unknown or malformed attachments no longer break entire message/update parsing.
- Request-location payloads can now be parsed when MAX sends a flat attachment object.
MAX platform gaps documented by live testing
Button::requestContact()sends successfully, but incoming contact attachments may contain emptycontact_idandvcf_phone.Button::requestGeoLocation()may arrive either as a structuredlocationattachment or as a client map-card/link fallback.sendSenderAction($chatId, SenderAction::TYPING_ON)returns success from the API, but the visible typing indicator is not reliably confirmed in the client.setMyCommands()remains experimental: livePOST /me/commandsrequests return404, and the public MAX REST docs do not currently expose a documented write endpoint for command menu updates.
Verification
composer dump-autoloadphp -r 'require "vendor/autoload.php"; var_dump(class_exists("Maxoxide\\User"), class_exists("Maxoxide\\Update"), class_exists("Maxoxide\\Filter"));'find src tests examples -name '*.php' -exec php -l {} \;vendor/bin/phpunit testsvendor/bin/phpunit --bootstrap bootstrap.php tests
RU
Кратко о релизе
Этот релиз обновляет maxoxide-php под текущий публичный REST API MAX, добавляет вспомогательные методы для отправки медиа, делает разбор обновлений устойчивее к будущим типам MAX и расширяет Dispatcher до более практичного роутинга.
Ломающие изменения
Update::$timestampтеперь nullable, потому что неизвестные будущие update могут не содержать timestamp.- Для старого поведения с резервным значением
0используйтеUpdate::timestampOrDefault(). - Обычный текст должен задаваться отсутствием
NewMessageBody::$format.MessageFormatтеперь содержит только документированные MAX-значения:MARKDOWNиHTML. - Код, который вручную собирал сырые
Button-объекты дляopen_app, стоит перевести наButton::openApp(),Button::openAppWithPayload()илиButton::openAppFull(): они сериализуют официальную MAX wire-модель сweb_app, опциональнымpayloadи опциональнымcontact_id.
User::$name и ChatMember::$name в PHP оставлены как legacy aliases, но новый код лучше писать через firstName, lastName и displayName().
Добавлено
- Добавлен резервный разбор неизвестных
Updateи неизвестных вложений с сохранением raw JSON. - Добавлен разбор вложений как в форме с обёрнутым
payload, так и в плоской форме объекта вложения, поэтому updates отButton::requestGeoLocation()могут десериализоваться какAttachmentKind::LOCATIONсlatitudeиlongitude. - Добавлены типизированные классы строковых значений:
ChatTypeChatStatusMessageFormatButtonIntentLinkTypeAttachmentKindChatAdminPermissionSenderAction
- Расширены модели MAX для пользователей, чатов, участников, администраторов, video metadata, image/photo payloads, upload endpoints, upload responses и webhook subscriptions.
- В
UserиChatMemberдобавлены актуальные поля профиля MAX:firstNamelastNameusernamedescriptionavatarUrlfullAvatarUrlcommands, где они доступны
- Добавлены
Button::openApp(),Button::openAppWithPayload()иButton::openAppFull()с официальными полямиweb_app,payload,contact_id. - Добавлен
Button::clipboard(). - Добавлены builders и вспомогательные методы для исходящих сообщений и вложений:
NewMessageBody::empty()NewMessageBody::textOpt()NewMessageBody::withAttachments()NewMessageBody::withReplyTo()NewMessageBody::withForwardFrom()NewMessageBody::withNotify()NewAttachment::imageUrl()NewAttachment::imagePhotos()NewAttachment::imagePayload()
- Добавлен
SendMessageOptionsсdisable_link_preview. - Добавлены методы для сообщений, видео, участников и администраторов:
sendMessageToChatWithOptions()sendMessageToUserWithOptions()getMessagesByIds()getVideo()getMembersByIds()addAdmins()removeAdmin()
- Добавлены типизированные действия отправителя:
sendSenderAction()sendTypingOn()sendSendingImage()sendSendingVideo()sendSendingAudio()sendSendingFile()markSeen()
- Добавлены helpers загрузки и отправки для chat/user адресатов:
sendImageToChat()/sendImageToUser()sendVideoToChat()/sendVideoToUser()sendAudioToChat()/sendAudioToUser()sendFileToChat()/sendFileToUser()- варианты для байтов тех же типов медиа
- Добавлены
Bot::getUpdatesRaw()иRawUpdatesResponseдля raw polling до...
v1.0.0
First stable release.