PHP code example of blurgroup / quahog

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

    

blurgroup / quahog example snippets


// Create a new socket instance
$socket = (new \Socket\Raw\Factory())->createClient('unix:///var/run/clamav/clamd.ctl'); # Using a UNIX socket
$socket = (new \Socket\Raw\Factory())->createClient('tcp://192.168.1.1:3310'); # Using a TCP socket

// Create a new instance of the Client
$quahog = new \Xenolope\Quahog\Client($socket);

// Scan a file
$result = $quahog->scanFile('/tmp/virusfile');

// Scan a file or directory recursively
$result = $quahog->contScan('/tmp/virusdirectory');

// Scan a file or directory recursively using multiple threads
$result = $quahog->multiscanFile('/tmp/virusdirectory');

// Scan a stream, and optionally pass the maximum chunk size in bytes
$result = $quahog->scanStream(file_get_contents('/tmp/virusfile'), 1024);

// Scan multiple files in a row
$quahog->startSession();
$result = $quahog->scanFile('/tmp/virusfile');
$result2 = $quahog->scanFile('/tmp/virusfile2');
$quahog->endSession();

// Ping clamd
$result = $quahog->ping();

// Get ClamAV version details
$result = $quahog->version();

// View statistics about the ClamAV scan queue
$result = $quahog->stats();

// Reload the virus database
$quahog->reload();

// Shutdown clamd cleanly
$quahog->shutdown();