PHP code example of jdecool / clamav-client

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

    

jdecool / clamav-client example snippets


$clientFactory = new JDecool\ClamAV\ClientFactory();

$client = $clientFactory->create('127.0.0.1', 3310);
$client->ping(); // throw an ConnectionError exception if error occured

$clientFactory = new JDecool\ClamAV\ClientFactory();

$client = $clientFactory->create('127.0.0.1', 3310);
$analysis = $client->scan('/path/to/file');

$analysis->count(); // = 1
$analysis->isInfected(); // true or false
$analysis->getMessage(); // if file is infected, it contains malware name