Download the PHP package mammothcoding/maxoxide without Composer
On this page you can find all versions of the php package mammothcoding/maxoxide. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mammothcoding/maxoxide
More information about mammothcoding/maxoxide
Files in mammothcoding/maxoxide
Package maxoxide
Short Description Synchronous PHP library for the Max messenger Bot API.
License MIT
Homepage https://github.com/mammothcoding/maxoxide-php
Informations about the package maxoxide
Readme in different languages: RU
maxoxide-php
A synchronous PHP library for building bots on the Max messenger platform. Inspired by the Rust library maxoxide.
Requires PHP 7.4+, the curl and json extensions. No third-party runtime dependencies.
This PHP version is aligned with the Rust maxoxide 2.1.0 API surface: filtered polling, message markup parsing, new dialog updates, contact hash/max_info helpers, chat buttons, typed sender actions, media helpers, open_app/clipboard buttons, and image photos upload payloads.
Installation
Quick start
Project structure
API methods
| Method | Description |
|---|---|
getMe() |
Bot info |
editMyInfo(body) |
Edit bot profile, commands, or avatar via PATCH /me |
sendTextToChat(chatId, text) |
Send plain text to a dialog/group/channel by chatId |
sendTextToUser(userId, text) |
Send plain text to a user by global MAX userId |
sendMarkdownToChat(chatId, text) |
Send Markdown to a dialog/group/channel |
sendMarkdownToUser(userId, text) |
Send Markdown to a user by userId |
sendMessageToChat(chatId, body) |
Send a message with attachments or a keyboard by chatId |
sendMessageToChatWithOptions(chatId, body, options) |
Send with query options such as disable_link_preview |
sendMessageToUser(userId, body) |
Send a message with attachments or a keyboard by userId |
sendMessageToUserWithOptions(userId, body, options) |
Send to a user with query options |
editMessage(mid, body) |
Edit a message |
deleteMessage(mid) |
Delete a message |
getMessage(mid) |
Get a message by ID |
getMessages(chatId, ...) |
Get messages from a chat |
getMessagesByIds(ids, ...) |
Get one or more messages by message IDs |
getVideo(videoToken) |
Get uploaded video metadata and playback URLs |
answerCallback(body) |
Answer an inline button press |
getChats(...) |
List group chats |
getChat(chatId) |
Chat info |
editChat(chatId, body) |
Edit title or description |
deleteChat(chatId) |
Delete a chat |
sendAction(chatId, action) |
Typing indicator and other chat actions |
sendSenderAction(chatId, action) |
Send a typed sender action value |
sendTypingOn(chatId) / markSeen(chatId) |
Convenience sender actions |
sendSendingImage/Video/Audio/File(chatId) |
Convenience upload indicators |
getPinnedMessage(chatId) |
Get the pinned message |
pinMessage(chatId, body) |
Pin a message |
unpinMessage(chatId) |
Unpin |
getMembers(chatId, ...) |
List chat members |
getMembersByIds(chatId, userIds) |
Get selected chat members |
addMembers(chatId, userIds) |
Add members |
removeMember(chatId, userId) |
Remove a member |
removeMemberWithOptions(chatId, userId, options) |
Remove a member with options such as block=true |
getAdmins(chatId) |
List admins |
addAdmins(chatId, admins) |
Grant administrator rights |
removeAdmin(chatId, userId) |
Revoke administrator rights |
getMyMembership(chatId) |
Get the bot's own membership |
leaveChat(chatId) |
Leave a chat |
getSubscriptions() |
List webhook subscriptions |
subscribe(body) |
Register a webhook |
unsubscribe(url) |
Remove a webhook |
getUpdates(...) |
Run a single long-poll request |
getUpdatesRaw(...) |
Run a raw long-poll request before typed parsing |
getUpdatesWithTypes(..., types) |
Long polling limited to selected update types |
getUpdatesRawWithTypes(..., types) |
Raw JSON long polling limited to selected update types |
getUploadUrl(type) |
Get the MAX upload URL for an attachment type |
uploadFile(type, path, name, mime) |
Full two-step file upload |
uploadBytes(type, bytes, name, mime) |
Same, from raw bytes |
sendImage/Video/Audio/FileToChat(...) |
Upload a local file and send it to a chat |
sendImage/Video/Audio/FileToUser(...) |
Upload a local file and send it to a user |
sendImage/Video/Audio/FileBytesToChat(...) |
Upload bytes and send to a chat |
sendImage/Video/Audio/FileBytesToUser(...) |
Upload bytes and send to a user |
setMyCommands(commands) |
Experimental: MAX currently returns 404 |
userId vs chatId
These two identifiers are different:
userIdis the global ID of a MAX user.chatIdis the ID of a concrete dialog, group, or channel.- In a private chat,
message->sender->userIdidentifies the user, whilemessage->chatId()identifies the specific dialog with the bot. - Use
sendTextToChat/sendMessageToChatwhen you know the dialog or groupchatId. - Use
sendTextToUser/sendMessageToUserwhen you only know the globaluserId.
User and ChatMember now expose MAX-style profile fields: firstName, lastName, username, description, avatarUrl, fullAvatarUrl, and commands where applicable. Use displayName() when you need one printable name. The legacy name alias remains available for existing PHP callers.
Dispatcher filters
The first matching handler wins. Register more specific filters earlier.
Raw handlers always run before typed handlers. Unknown future update types are parsed as Update objects with raw() preserved.
Inline keyboard
Button::openAppFull($text, $webApp, $payload, $contactId) serializes the official MAX open_app wire model with web_app, optional payload, and optional contact_id.
Button::chatFull($text, $chatTitle, $chatDescription, $startPayload, $uuid) serializes the documented chat button model. Current live testing still treats send-time chat button rejection as a MAX platform limitation when the API returns 400 Can't deserialize body.
File uploads
MAX uses a two-step upload flow. uploadFile and uploadBytes return a usable attachment token:
For the common upload-and-send flow, use the helpers:
Image uploads can return a MAX photos token map instead of a single token. The sendImage* helpers preserve that payload automatically and retry briefly while MAX reports the attachment as not processed yet.
Important: the
phototype has been removed from the MAX API. Always useUploadType::IMAGE.
Webhook (without a framework)
Register the webhook once:
MAX requires HTTPS on port 443. Self-signed certificates are not supported.
Error handling
All API errors throw Maxoxide\MaxException:
Global handler for dispatcher callback errors:
Running tests
Known MAX platform gaps (May 2026)
Button::requestContactis live-confirmed to delivervcf_info, a validhash, andmax_info;vcf_phonemay still be empty, so usephonesFromVcf()as a fallback.Button::requestGeoLocationis live-confirmed to deliver a structuredlocationattachment with coordinates.Button::chatFull()follows the documentedchatbutton JSON, but current livePOST /messagesrequests may be rejected with400 Can't deserialize body.setMyCommandscurrently returns404fromPOST /me/commands.
Live API test
There is an interactive harness for end-to-end checks against the real API:
At startup it asks for the language, update transport, bot token, and optional settings:
- update transport:
long_pollingorwebhook - bot URL for the tester
- webhook URL and secret for subscribe/unsubscribe checks, webhook mode, and restoring temporarily disabled subscriptions
- local webhook listen address when
webhooktransport is selected - path to a local file for
uploadFile - optional paths to image, video, and audio files for media helper checks
- request delay, HTTP timeout, and polling timeout
Then the harness walks through each phase:
Private chat: sending /live to the bot activates the phase. It checks sendTextToChat, sendTextToUser, sendMarkdown*, message markup returned by getMessage, sendMessageToChatWithOptions, inline keyboards with callback/message/contact/location/link buttons, optional open_app, clipboard, opt-in chat button / message_chat_created, answerCallback, editMessage, getMessage, getMessages, getMessagesByIds, and deleteMessage.
Uploads: getUploadUrl for all types, uploadFile, uploadBytes, file helpers for chat/user, byte helpers, optional sendImageToChat, sendVideoToChat, getVideo, sendAudioToChat, and sending uploaded attachments back to the chat.
Updates transport: in long_polling mode the harness checks active webhook subscriptions, can temporarily unsubscribe them, restores them at the end, and probes getUpdatesWithTypes / getUpdatesRawWithTypes. In webhook mode it starts a local receiver and manual waits consume incoming webhook POSTs.
Webhook: getSubscriptions, subscribe, unsubscribe if a webhook URL is provided and the run is not already using webhook transport.
Commands: experimental setMyCommands check. MAX currently returns 404.
Group chat: sending /group_live in a group activates the phase. It checks getChat, getMembers, getMembersByIds, getAdmins, getMyMembership, typed sender actions, sender-action helpers, pin/unpin, editChat with automatic rollback, optional addAdmins/removeAdmin, addMembers, removeMember, opt-in removeMemberWithOptions(..., block=true), deleteChat, and leaveChat.
Optional dialog events: at the end the harness can wait for bot_stopped, dialog_cleared, dialog_muted, dialog_unmuted, and dialog_removed.
Each step is reported as PASS, FAIL, or SKIP, and the full summary is printed at the end.
License
All versions of maxoxide with dependencies
ext-curl Version *
ext-json Version *