sineflow / clamav
ClamAV PHP Client for Symfony
Installs: 119 202
Dependents: 0
Suggesters: 1
Security: 0
Stars: 8
Watchers: 3
Forks: 3
Open Issues: 2
Type:symfony-bundle
pkg:composer/sineflow/clamav
Requires
- php: ^7.3 || ^8.0
- ext-sockets: *
- symfony/config: ~4.0 || ~5.0 || ~6.0 || ~7.0
- symfony/dependency-injection: ~4.0 || ~5.0 || ~6.0 || ~7.0
- symfony/http-kernel: ~4.0 || ~5.0 || ~6.0 || ~7.0
- symfony/yaml: ~4.0 || ~5.0 || ~6.0 || ~7.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.5
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2025-10-22 14:01:24 UTC
README
This library is a PHP client for working with a ClamAV daemon. It also provides optional Symfony integration.
Requirements:
You need to have ClamAV installed and configured to accept socket and/or network connections: https://docs.clamav.net/manual/Installing.html
Installation
$ composer require sineflow/clamav
Usage as a standalone library
$scanner = new Scanner(new ScanStrategyClamdUnix($socket));
$scanner = new Scanner(new ScanStrategyClamdNetwork($host, $port));
Usage as a Symfony bundle
Enable the bundle
// config/bundles.php return [ // ... Sineflow\ClamAV\Bundle\SineflowClamAVBundle::class => ['all' => true], ];
Configuration:
sineflow_clam_av:
    strategy: clamd_unix
    socket: "/var/run/clamav/clamd.ctl"
or
sineflow_clam_av:
    strategy: clamd_network
    host: 127.0.0.1
    port: 3310
Scanning files
use Sineflow\ClamAV\Scanner;
use Sineflow\ClamAV\Exception\FileScanException;
use Sineflow\ClamAV\Exception\SocketException;
public function myAction(Scanner $scanner)
{
    try {
        $scannedFile = $scanner->scan($file);
        if (!$scannedFile->isClean()) {
            echo $scannedFile->getVirusName();
        }
    } catch (SocketException $e) {
        ...
    } catch (FileScanException $e) {
        ...
    }
}