Skip to content
A PHP client library for the ClamAV clamd daemon
PHP
Branch: develop
Clone or download
Pull request Compare This branch is even with jonjomckay:develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Quahog
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Quahog

Build Status

Quahog is a simple PHP library to interface with the clamd anti-virus daemon. It was written as all of the libraries out there for interfacing with ClamAV from PHP use exec('clamscan'), which isn't exactly an ideal solution, as clamscan loads the entire database into memory each time it is run - this doesn't, so it scans a lot (lot!) faster.

Installation

It is recommended to install Quahog through composer.

{
    "require": {
        "xenolope/quahog": "2.*"
    }
}

Usage

// Create a new socket instance
$socket = (new \Socket\Raw\Factory())->createClient('unix:///var/run/clamav/clamd.ctl');

// 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();

Testing

To run the test suite you will need PHPUnit installed. Go to the project root and run:

$ phpunit

License

Quahog is released under the MIT License

You can’t perform that action at this time.