PHP code example of yuryiseliverstov / whatsapp-stream

1. Go to this page and download the library: Download yuryiseliverstov/whatsapp-stream 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/ */

    

yuryiseliverstov / whatsapp-stream example snippets




uryiseliverstov\WhatsAppStream\WhatsAppStream;

$samplesDir = 'vendor/yuryiseliverstov/whatsapp-stream/samples/';
$outputDir = 'WhatsAppStreamOutput/';

if (!is_dir($outputDir))
    mkdir($outputDir);

/**
 * Encryption Image
 */
$imageStream = new WhatsAppStream($samplesDir.'IMAGE.encrypted', $samplesDir.'IMAGE.key', WhatsAppStream::MEDIA_TYPE_IMAGE,false);
file_put_contents($outputDir.'IMAGE.encrypted', $imageStream->getEncryptedContents());

/**
 * Decryption Audio
 */
$audioStream = new WhatsAppStream($samplesDir.'AUDIO.encrypted', $samplesDir.'AUDIO.key', WhatsAppStream::MEDIA_TYPE_AUDIO,true);
file_put_contents($outputDir.'AUDIO.original', $audioStream->getContents());

/**
 * Decryption Video
 */
$videoStream = new WhatsAppStream($samplesDir.'VIDEO.encrypted', $samplesDir.'VIDEO.key', WhatsAppStream::MEDIA_TYPE_VIDEO,true);
file_put_contents($outputDir.'VIDEO.original', $videoStream->getContents());
echo 'Job Done!'.PHP_EOL;