PHP code example of cacko / yii2-clamav

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

    

cacko / yii2-clamav example snippets



    'components' => [
    .....
        'clamav' => [
            'class' => 'Cacko\ClamAv\Scanner',
            'driver' => 'clamd_local',
            'socket' => '/var/run/clamav/clamd.sock'
        ],


    'components' => [
    .....
        'clamav' => [
            'class' => 'Cacko\ClamAv\Scanner',
            'driver' => 'clamscan',
            'executable' => '/usr/local/bin/clamdscan'
        ],


    'components' => [
    .....
        'clamav' => [
            'class' => 'Cacko\ClamAv\Scanner',
            'driver' => 'clamd_local',
            'host' => '127.0.0.1',
            'port' => 3310
        ],


    'components' => [
    .....
        'clamav' => [
            'class' => 'Cacko\ClamAv\Scanner',
            'driver' => 'clamd_remote',
            'host' => '192.168.0.10',
            'port' => 3310
        ],


    'components' => [
    .....
        'clamav' => [
            'class' => 'Cacko\ClamAv\Scanner',
            'driver' => 'dummy',
        ],



$result = Yii::$app->clamav->scan('my_file.txt');




$result = Yii::$app->clamav->scanBuffer(file_get_contents('my_file.txt'));




$result = Yii::$app->clamav->scanResource(new SplFileObject('my_file.txt'), 'rb');