### Start MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeClassic Shows how to start the MadelineProto client, which is necessary to begin interacting with the Telegram network. This method handles authentication and connection setup. Requires a valid MadelineProto client instance. ```PHP $MadelineProto->start(); ``` -------------------------------- ### Start MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeArctic Shows how to start the MadelineProto client, which is necessary to begin interacting with the Telegram network. This method handles authentication and connection setup. Requires a valid MadelineProto client instance. ```PHP $MadelineProto->start(); ``` -------------------------------- ### Composer Installation from Scratch Source: https://docs.madelineproto.xyz/docs/INSTALLATION This JSON file defines the project's dependencies, requiring MadelineProto v8+. After creating this `composer.json` file, the `composer update` command should be run to download and install the package. This is suitable for starting new projects with Composer. ```json { "name": "yourname/yourproject", "description": "Project description", "type": "project", "require": { "danog/madelineproto": "^8" }, "license": "AGPL-3.0-only", "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ], "autoload": { "psr-0": { "Your\\Project\\": "src/" } } } ``` -------------------------------- ### Start MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/channelParticipantsBots Shows how to start the MadelineProto client, which is necessary to begin interacting with the Telegram network. This method handles authentication and connection setup. Requires a valid MadelineProto client instance. ```PHP $MadelineProto->start(); ``` -------------------------------- ### Docker Command to Start Webserver Source: https://docs.madelineproto.xyz/docs/DOCKER This command initiates the Docker Compose setup defined in the docker-compose.yml file. It ensures the latest image is pulled and runs the services in detached mode. ```bash docker compose up --pull always -d ``` -------------------------------- ### Install MadelineProto Plugins via File Path (PHP) Source: https://docs.madelineproto.xyz/docs/PLUGINS This PHP snippet demonstrates how to install MadelineProto plugins by placing their files in a 'plugins/' directory. It includes logic to download MadelineProto if not found via Composer and sets up a BaseHandler that extends SimpleEventHandler to specify the plugin path. It configures logger settings and starts the event loop for users or bots. ```php getLogger()->setLevel(Logger::LEVEL_ULTRA_VERBOSE); // You can also use Redis, MySQL or PostgreSQL // $settings->setDb((new Redis)->setDatabase(0)->setPassword('pony')); // $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // For users or bots BaseHandler::startAndLoop('bot.madeline', $settings); // For bots only // BaseHandler::startAndLoopBot('bot.madeline', 'bot token', $settings); ``` -------------------------------- ### PHP: Start MadelineProto event loop for users or bots Source: https://docs.madelineproto.xyz/docs/UPDATES This snippet shows how to start the MadelineProto event loop using a custom event handler class. It provides separate methods for starting as a user/bot or exclusively as a bot, requiring the session file path, bot token (if applicable), and settings object. ```php // For users or bots MyEventHandler::startAndLoop('bot.madeline', $settings); // For bots only // MyEventHandler::startAndLoopBot('bot.madeline', 'bot token', $settings); ``` -------------------------------- ### BaseThemeNight Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeNight Provides an example of how to initialize the baseThemeNight constructor, which is part of the Just the Docs theme for Gojekyll. ```php $baseThemeNight = ['_' => 'baseThemeNight']; ``` -------------------------------- ### Create a MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeClassic Demonstrates how to instantiate a MadelineProto client. This is the starting point for interacting with the Telegram API using the library. Requires the MadelineProto library to be installed. ```PHP use danog\MadelineProto\API; $settings = [...]; // Your settings array $MadelineProto = new API('session.madeline', $settings); ``` -------------------------------- ### Start and Loop Methods Source: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/SimpleEventHandler Methods for starting the MadelineProto client and its event handler, with options for regular user accounts and bots. ```APIDOC ## POST /startAndLoop ### Description Starts MadelineProto and the event handler for a regular user account. Initializes error reporting and catches all errors from the event loop. ### Method POST ### Endpoint /startAndLoop ### Parameters #### Request Body - **session** (string) - Required - Session name - **settings** (object|null) - Optional - Settings object ### Request Example ```json { "session": "my_session", "settings": null } ``` ### Response #### Success Response (200) - **status** (string) - Indicates successful start. #### Response Example ```json { "status": "started" } ``` ## POST /startAndLoopBot ### Description Starts MadelineProto as a bot and the event handler. Initializes error reporting and catches all errors from the event loop. ### Method POST ### Endpoint /startAndLoopBot ### Parameters #### Request Body - **session** (string) - Required - Session name - **token** (string) - Required - Bot token - **settings** (object|null) - Optional - Settings object ### Request Example ```json { "session": "my_bot_session", "token": "YOUR_BOT_TOKEN", "settings": null } ``` ### Response #### Success Response (200) - **status** (string) - Indicates successful bot start. #### Response Example ```json { "status": "bot_started" } ``` ``` -------------------------------- ### Download and Include MadelineProto (Simple) Source: https://docs.madelineproto.xyz/docs/INSTALLATION This PHP code snippet downloads the latest `madeline.php` file if it doesn't exist and includes it. It is not recommended for production environments due to potential breaking changes and automatic updates. This method is for simple, non-production setups. ```php messages->sendMessage(['peer' => '@danogentili', 'message' => 'hi']); ``` -------------------------------- ### Create a MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeArctic Demonstrates how to instantiate a MadelineProto client. This is the starting point for interacting with the Telegram API using the library. Requires the MadelineProto library to be installed. ```PHP use danog\MadelineProto\API; $settings = [...]; // Your settings array $MadelineProto = new API('session.madeline', $settings); ``` -------------------------------- ### Install Docker and Configure System Settings Source: https://docs.madelineproto.xyz/docs/DOCKER Installs Docker, increases sysctl max_map_count for fiber stability, and raises the open file descriptor limit for improved network performance. ```shell curl -fsSL https://get.docker.com | sudo sh echo 262144 | sudo tee /proc/sys/vm/max_map_count echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf sudo mkdir -p /etc/security/limits.d/ echo '* soft nofile 1048576' | sudo tee -a /etc/security/limits.d/40-madelineproto.conf echo '* hard nofile 1048576' | sudo tee -a /etc/security/limits.d/40-madelineproto.conf ``` -------------------------------- ### Create a MadelineProto Client Source: https://docs.madelineproto.xyz/API_docs/constructors/channelParticipantsBots Demonstrates how to instantiate a MadelineProto client. This is the starting point for interacting with the Telegram API using the library. Requires the MadelineProto library to be installed. ```PHP use danog\MadelineProto\API; $settings = [...]; // Your settings array $MadelineProto = new API('session.madeline', $settings); ``` -------------------------------- ### UserProfilePhoto Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/userProfilePhoto Example demonstrating the structure of the UserProfilePhoto constructor. This example shows how to define the constructor with its various attributes and their types. ```php $userProfilePhoto = ['_' => 'userProfilePhoto', 'has_video' => Bool, 'personal' => Bool, 'photo_id' => long, 'stripped_thumb' => 'bytes', 'dc_id' => int]; ``` -------------------------------- ### Send Audio Message - Example Source: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API Example of sending an audio file as a message. This shows how to specify the peer and the audio file source. ```php /* * Example usage: * $peer = 'username'; // or user ID * $audioFilePath = '/path/to/audio.ogg'; * $message = $MadelineProto->sendAudio($peer, $audioFilePath, caption: 'My audio message'); */ ``` -------------------------------- ### BaseTheme Constructor Example (Python) Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeArctic Demonstrates the basic constructor for the Arctic theme, which is a modified documentation theme for Gojekyll. This example shows how to initialize the baseThemeArctic variable. ```Python $baseThemeArctic = ['_' => 'baseThemeArctic']; ``` -------------------------------- ### PHP: Get Started with MadelineProto for Telegram API Interaction Source: https://docs.madelineproto.xyz/index This snippet demonstrates the initial setup and basic usage of MadelineProto, a PHP library for the Telegram MTProto API. It includes installing the library, starting a session, getting user information, sending a message, joining a channel, and importing a chat invite. PHP 8.2+ is required. It can be run in a browser or console. ```php start(); $me = $MadelineProto->getSelf(); $MadelineProto->logger($me); if (!$me['bot']) { $MadelineProto->messages->sendMessage(peer: '@stickeroptimizerbot', message: "/start"); $MadelineProto->channels->joinChannel(channel: '@MadelineProto'); try { $MadelineProto->messages->importChatInvite(hash: 'https://t.me/+Por5orOjwgccnt2w'); } catch (\danog\MadelineProto\RPCErrorException $e) { $MadelineProto->logger($e); } } $MadelineProto->echo('OK, done!'); ``` -------------------------------- ### BaseTheme Classic Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/baseThemeClassic Provides an example of how to initialize the `baseThemeClassic` constructor, which is part of the BaseTheme type in MadelineProto. This is typically used for theme-related configurations. ```PHP $baseThemeClassic = ['_' => 'baseThemeClassic']; ``` -------------------------------- ### Reupload CDN File using MadelineProto Source: https://docs.madelineproto.xyz/API_docs/methods/upload Example demonstrating how to reupload a CDN file using the upload.reuploadCdnFile method in MadelineProto. This snippet shows the basic setup and method call, assuming MadelineProto is installed and included. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new danogMadelineProtoAPI('session.madeline'); $MadelineProto->start(); $Vector_of_FileHash = $MadelineProto->upload->reuploadCdnFile(file_token: 'string', request_token: 'bytes', ); ``` -------------------------------- ### Get Timezones List using MadelineProto (PHP) Source: https://docs.madelineproto.xyz/API_docs/methods/help This snippet demonstrates how to retrieve a list of timezones using the MadelineProto library in PHP. It requires the MadelineProto library to be installed and includes basic setup and API call execution. The `hash` parameter is optional and expects an array of longs or strings. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->start(); $help_TimezonesList = $MadelineProto->help->getTimezonesList(hash: [$long\|string, $long\|string], ); ``` -------------------------------- ### Start MadelineProto Bot in Background Source: https://docs.madelineproto.xyz/docs/DOCKER Starts the MadelineProto bot service defined in docker-compose.yml in detached mode (background). Ensures always-on availability with automatic restarts. ```shell docker compose up --pull always -d ``` -------------------------------- ### Constructor Source: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API Initializes a new instance of the MadelineProto client. ```APIDOC ## __construct ### Description Constructor for the MadelineProto client. Initializes the client with a session name and optional settings. ### Method Constructor ### Endpoint N/A (This is a constructor method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `session` (string) - The name of the session file to use or create. * `settings` (\danog\MadelineProto\SettingsAbstract) - Optional settings object for configuring the client. ### Request Example ```json { "session": "my_session", "settings": { "@type": "type.googleapis.com/madelineproto.Settings" } } ``` ### Response #### Success Response (200) * `MadelineProto` - An instance of the MadelineProto client. #### Response Example (The constructor initializes the object; no explicit response body) ``` -------------------------------- ### InputBusinessChatLink Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/inputBusinessChatLink A PHP example demonstrating the structure of the InputBusinessChatLink constructor, showing how to initialize it with a message, entities, parse mode, and title. ```php $inputBusinessChatLink = ['_' => 'inputBusinessChatLink', 'message' => 'string', 'entities' => [MessageEntity, MessageEntity], 'parse_mode' => 'string', 'title' => 'string']; ``` -------------------------------- ### StarRefProgram Constructor Initialization (Example) Source: https://docs.madelineproto.xyz/API_docs/constructors/starRefProgram This example demonstrates how to initialize a StarRefProgram object using a predefined structure. It includes placeholders for bot ID, commission percentage, duration, end date, and daily revenue per user. ```PHP $starRefProgram = ['_' => 'starRefProgram', 'bot_id' => long, 'commission_permille' => int, 'duration_months' => int, 'end_date' => int, 'daily_revenue_per_user' => StarsAmount]; ``` -------------------------------- ### BotApp Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/botApp Provides an example of how to construct a BotApp object in PHP, detailing its attributes and their types. This is used for direct link Mini Apps. ```php $botApp = ['_' => 'botApp', 'id' => long, 'access_hash' => long, 'short_name' => 'string', 'title' => 'string', 'description' => 'string', 'photo' => Photo, 'document' => Document, 'hash' => long]; ``` -------------------------------- ### BotPreviewMedia Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/botPreviewMedia This example demonstrates the structure of the BotPreviewMedia constructor, which represents media for a Main Mini App preview. It includes attributes for the update date and the actual media content. ```PHP $botPreviewMedia = ['_' => 'botPreviewMedia', 'date' => int, 'media' => MessageMedia]; ``` -------------------------------- ### MadelineProto Example: Validate Requested Order Info Source: https://docs.madelineproto.xyz/API_docs/methods/payments This example demonstrates how to use the payments.validateRequestedInfo method with MadelineProto. It includes setup for the library and the actual method call with placeholder variables for invoice and info. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->start(); $payments_ValidatedRequestedInfo = $MadelineProto->payments->validateRequestedInfo(save: $Bool, invoice: $InputInvoice, info: $PaymentRequestedInfo, ); ``` -------------------------------- ### Initialize MadelineProto Connection (PHP) Source: https://docs.madelineproto.xyz/API_docs/methods/initConnection This snippet demonstrates how to initialize a connection with MadelineProto. It includes steps for downloading the library if it doesn't exist and then establishing the connection using the `initConnection` method with various optional parameters. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->start(); $X = $MadelineProto->initConnection(api_id: $int, device_model: 'string', system_version: 'string', app_version: 'string', system_lang_code: 'string', lang_pack: 'string', lang_code: 'string', proxy: $InputClientProxy, params: $JSONValue, query: $!X, ); ``` -------------------------------- ### DecryptedMessageActionResend Constructor Example Source: https://docs.madelineproto.xyz/API_docs/constructors/decryptedMessageActionResend_17 Provides an example of how to construct a `decryptedMessageActionResend` object, which is used to request the other party in a Secret Chat to automatically resend a range of previously sent messages. It specifies the start and end sequence numbers for the messages to be resent. ```php $decryptedMessageActionResend_17 = ['_' => 'decryptedMessageActionResend', 'start_seq_no' => int, 'end_seq_no' => int]; ``` -------------------------------- ### MadelineProto User Signup with auth.signUp Source: https://docs.madelineproto.xyz/API_docs/methods/auth This PHP snippet demonstrates how to initiate a user signup process using the auth.signUp method in MadelineProto. It requires including the MadelineProto library and starting an API instance. The method accepts various optional parameters for user details and notification preferences. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new danogMadelineProtoAPI('session.madeline'); $MadelineProto->start(); $auth_Authorization = $MadelineProto->auth->signUp(no_joined_notifications: $Bool, phone_number: 'string', phone_code_hash: 'string', first_name: 'string', last_name: 'string'); ``` -------------------------------- ### Dockerfile for Custom PHP Extensions Source: https://docs.madelineproto.xyz/docs/DOCKER This Dockerfile extends the official MadelineProto image to include custom PHP extensions. It downloads and executes a PHP extension installer script to add 'gd' and 'bcmath' extensions, then cleans up the installer. ```dockerfile FROM hub.madelineproto.xyz/danog/madelineproto:latest ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN chmod +x /usr/local/bin/install-php-extensions && \ install-php-extensions gd bcmath && \ rm /usr/local/bin/install-php-extensions ``` -------------------------------- ### Initialize MadelineProto with AppInfo Settings Source: https://docs.madelineproto.xyz/docs/SETTINGS Demonstrates how to create MadelineProto instance with initial AppInfo settings like API ID and hash. This involves instantiating AppInfo, setting its properties, and then passing it to the MadelineProto constructor. Note that it's recommended to remove the settings parameter after login to optimize performance. ```php $settings = (new \danog\MadelineProto\Settings\AppInfo) ->setApiId(124) ->setApiHash('xx'); $API = new \danog\MadelineProto\API('session.madeline', $settings); ``` -------------------------------- ### startAndLoop Source: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler Starts the MadelineProto client and enters the main event loop. This method requires a session string and optionally accepts settings. ```APIDOC ## startAndLoop(string $session, ?\danog\MadelineProto\SettingsAbstract $settings = NULL): void ### Description Starts the MadelineProto client and enters the main event loop. ### Parameters - **session** (string) - Required - Session string for the MadelineProto client. - **settings** (SettingsAbstract) - Optional - Settings for the MadelineProto client. ### Return Value void ``` -------------------------------- ### Help and Support Methods Source: https://docs.madelineproto.xyz/API_docs/constructors/botVerifierSettings Provides methods for interacting with Telegram's help and support features, including accepting terms of service, getting app configurations, and retrieving support information. ```python help.acceptTermsOfService help.dismissSuggestion help.editUserInfo help.getAppConfig help.getAppUpdate help.getCdnConfig help.getConfig help.getCountriesList help.getDeepLinkInfo help.getInviteText help.getNearestDc help.getPassportConfig help.getPeerColors help.getPeerProfileColors help.getPremiumPromo help.getPromoData help.getRecentMeUrls help.getSupport help.getSupportName help.getTermsOfServiceUpdate help.getTimezonesList help.getUserInfo help.hidePromoData help.saveAppLog help.setBotUpdatesStatus ``` -------------------------------- ### BusinessWeeklyOpen Type Example Source: https://docs.madelineproto.xyz/API_docs/constructors/businessWeeklyOpen Demonstrates the structure of the BusinessWeeklyOpen type, which represents a business's weekly opening hours. It includes start and end minutes within a week. ```Python $businessWeeklyOpen = ['_' => 'businessWeeklyOpen', 'start_minute' => int, 'end_minute' => int]; ``` -------------------------------- ### Initialize MadelineProto API Client (PHP) Source: https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT This snippet demonstrates how to create a new MadelineProto API client instance. It shows how to specify the session file path for serialization and loading. The `$settings` array can be used for further configuration, such as specifying database backends for ephemeral storage. ```php $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings); // The session will be serialized to session.madeline ``` ```php $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings); // The session will be loaded from session.madeline ``` -------------------------------- ### Get Language Info with MadelineProto Source: https://docs.madelineproto.xyz/API_docs/methods/langpack This example demonstrates how to use the langpack.getLanguage method in MadelineProto to retrieve information about a language pack. It requires the MadelineProto library to be included and initialized. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new danogMadelineProtoAPI('session.madeline'); $MadelineProto->start(); $LangPackLanguage = $MadelineProto->langpack->getLanguage(lang_pack: 'string', lang_code: 'string', ); ``` -------------------------------- ### PHP Example: wallPaperSettings Constructor Usage Source: https://docs.madelineproto.xyz/API_docs/constructors/wallPaperSettings This PHP code snippet demonstrates how to instantiate and use the wallPaperSettings constructor. It shows the expected format for providing wallpaper settings, including boolean flags for effects and integer values for colors and rotation. Note that this is a representation and actual implementation may vary. ```php $wallPaperSettings = ['_' => 'wallPaperSettings', 'blur' => true, 'motion' => false, 'background_color' => 123456, 'second_background_color' => 789012, 'third_background_color' => 345678, 'fourth_background_color' => 901234, 'intensity' => 50, 'rotation' => 45, 'emoticon' => '😊']; ``` -------------------------------- ### Leave Chatlist with MadelineProto (PHP) Source: https://docs.madelineproto.xyz/API_docs/methods/chatlists Example demonstrating how to leave a chatlist using MadelineProto's chatlists.leaveChatlist method in PHP. This code requires the MadelineProto library to be installed and configured. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->start(); $Updates = $MadelineProto->chatlists->leaveChatlist(chatlist: $InputChatlist, peers: [$InputPeer, $InputPeer]); ``` -------------------------------- ### Instantiate BusinessIntro Constructor (PHP Example) Source: https://docs.madelineproto.xyz/API_docs/constructors/businessIntro This snippet demonstrates how to instantiate the BusinessIntro constructor. It requires a 'title' and 'description' and can optionally include a 'sticker'. The example uses a PHP-like syntax. ```php $businessIntro = ['_' => 'businessIntro', 'title' => 'string', 'description' => 'string', 'sticker' => Document]; ``` -------------------------------- ### BotAppSettings Constructor Example (Python) Source: https://docs.madelineproto.xyz/API_docs/constructors/botAppSettings Provides an example of how to instantiate the BotAppSettings constructor in Python. It shows the expected structure and data types for its attributes, including placeholder path, background colors, and header colors for both light and dark modes. ```Python $botAppSettings = ['_' => 'botAppSettings', 'placeholder_path' => 'bytes', 'background_color' => int, 'background_dark_color' => int, 'header_color' => int, 'header_dark_color' => int]; ``` -------------------------------- ### Invoke with Layer - PHP Example Source: https://docs.madelineproto.xyz/API_docs/methods/invokeWithLayer This PHP snippet demonstrates how to initialize MadelineProto and use the invokeWithLayer method. It includes setup for the PHAR file and API initialization. Ensure 'session.madeline' is correctly configured. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new \danog\MadelineProto\API('session.madeline'); $MadelineProto->start(); $X = $MadelineProto->invokeWithLayer(layer: $int, query: $!X, ); ``` -------------------------------- ### Toggle Group Call Settings with MadelineProto Source: https://docs.madelineproto.xyz/API_docs/methods/phone Example of how to toggle group call settings using MadelineProto. This code snippet demonstrates the usage of the phone.toggleGroupCallSettings method with its parameters. Ensure MadelineProto is installed and configured. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new danogMadelineProtoAPI('session.madeline'); $MadelineProto->start(); $Updates = $MadelineProto->phone->toggleGroupCallSettings(reset_invite_hash: $Bool, call: $InputGroupCall, join_muted: $Bool, ); ``` -------------------------------- ### Constructor and Instance Management Source: https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API Methods related to the constructor and managing multiple instances. ```APIDOC ## CONSTRUCTOR /websites/madelineproto_xyz/__construct ### Description Initializes a new MadelineProto instance. ### Method CONSTRUCTOR ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters - **session** (string) - The session identifier. - **settings** (SettingsAbstract) - Optional settings for the instance. ### Response (Constructor, typically returns an instance of the class) ## POST /websites/madelineproto_xyz/startAndLoopMulti ### Description Starts and loops multiple MadelineProto instances with a specified event handler. ### Method POST ### Endpoint /websites/madelineproto_xyz/startAndLoopMulti ### Parameters #### Request Body - **instances** (array) - An array of MadelineProto API instances. - **eventHandler** (array>|class-string) - The event handler(s) to use. ### Response (No specific response body defined, likely a success indicator or void) ``` -------------------------------- ### SecureSecretSettings Constructor Example (PHP) Source: https://docs.madelineproto.xyz/API_docs/constructors/secureSecretSettings An example demonstrating how to initialize the SecureSecretSettings constructor. It specifies the type and required attributes for secure password derivation. ```php $secureSecretSettings = ['_' => 'secureSecretSettings', 'secure_algo' => SecurePasswordKdfAlgo, 'secure_secret' => 'bytes', 'secure_secret_id' => long]; ``` -------------------------------- ### Document Constructor Example - PHP Source: https://docs.madelineproto.xyz/API_docs/constructors/document This snippet demonstrates the structure of the Document constructor in PHP, as used by MadelineProto. It outlines the expected data types for each attribute, serving as a guide for creating or interpreting Document objects. ```php $document = ['_' => 'document', 'id' => long, 'access_hash' => long, 'file_reference' => 'bytes', 'date' => int, 'mime_type' => 'string', 'size' => long, 'thumbs' => [PhotoSize, PhotoSize], 'video_thumbs' => [VideoSize, VideoSize], 'dc_id' => int, 'attributes' => [DocumentAttribute, DocumentAttribute]]; ``` -------------------------------- ### Upload Media with MadelineProto (PHP) Source: https://docs.madelineproto.xyz/API_docs/methods/messages_uploadMedia Example demonstrating how to use the messages.uploadMedia method in MadelineProto. This snippet initializes the MadelineProto API, starts the connection, and then calls uploadMedia with placeholder values for business_connection_id, peer, and media. ```php if (!file_exists('madeline.php')) { copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php'); } include 'madeline.php'; $MadelineProto = new danogMadelineProtoAPI('session.madeline'); $MadelineProto->start(); $MessageMedia = $MadelineProto->messages->uploadMedia(business_connection_id: 'string', peer: $InputPeer, media: $InputMedia, ); ``` -------------------------------- ### Load MadelineProto Library - PHP Source: https://docs.madelineproto.xyz/docs/UPDATES This code snippet demonstrates how to load the MadelineProto library. It first checks for the Composer autoloader and then falls back to downloading an alpha version of `madeline.php` if necessary. This ensures the library is available for use. ```php