PHP code example of oseias-isidoro / evoluiton-sdk

1. Go to this page and download the library: Download oseias-isidoro/evoluiton-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oseias-isidoro / evoluiton-sdk example snippets




use EvolutionSDK\Messages\MessageBuilder;
use EvolutionSDK\Messages\Messenger;

$builder = new MessageBuilder();

$message = $builder
    ->from('[instance]')
    ->to('[remoteJid]')
    ->text('simple text')
    ->getMessage();


if ((new Messenger())->send($message)) {
    echo "success";
} else {
    echo "error";
}


    media(string $url, string $mediaType, string $fileName = null);
    
    $builder->media(
        'https://path_to_file',
        'document', // document, image, video
        'file_name' // Optional, just for document media type 
    );

    audio(string $url);
    
    $builder->audio('https://path_to_file');

    mentions(bool $everyOne = true, array $data = []);
    
    $builder->mentions(false, [
        "[remoteJid]",
        "[remoteJid]",
    ]);

    reply(array $data);
    
    $builder->reply([
        "key" => [
            "remoteJid" => "[remoteJid]@s.whatsapp.net",
            "fromMe" => "true",
            "id" => "BAE5766236A2AEFF",
            "participant" => "",
        ],
        "message" => [
            "conversation" => "Plain text message, sent with the _Evolution-API_ 🚀."
        ]
    ]);