2017 © Pedro Peláez
 

library quahog

A PHP client library for ClamAV clamd daemon

image

xenolope/quahog

A PHP client library for ClamAV clamd daemon

  • Wednesday, May 16, 2018
  • by jonjomckay
  • Repository
  • 8 Watchers
  • 35 Stars
  • 95,212 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 15 Forks
  • 1 Open issues
  • 10 Versions
  • 30 % Grown

The README.md

Quahog

Build Status, (*1)

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., (*2)

Installation

It is recommended to install Quahog through composer., (*3)

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

Usage

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

Working with the result

``` php // Result is an instance of \Xenolope\Quahog\Result. $result = $quahog->scanFile('/tmp/virusfile');, (*4)

// A result id of a session that was used. $result->getId();, (*5)

// The file name of the scanned file. $result->getFilename();, (*6)

// The reason why a scan resulted in a failure. Returns null if the scan was successful. $result->getReason();, (*7)

// A boolean value that is true, in case the scan was successful. $result->isOk();, (*8)

// A boolean value that is true, in case the scan failed. This is the opposite of isOk(). $result->hasFailed();, (*9)

// A boolean value that is true, if a virus was found. $result->isFound();, (*10)

// A boolean value that is true, if an error happened. $result->isError(); ```, (*11)

Testing

To run the test suite you will need PHPUnit installed. Go to the project root and run:, (*12)

$ phpunit

License

Quahog is released under the MIT License, (*13)

The Versions

16/05 2018

dev-develop

dev-develop

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

The Development Requires

22/02 2017

dev-master

9999999-dev

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

The Development Requires

22/02 2017

v2.1.0

2.1.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

The Development Requires

07/12 2016

v2.0.0

2.0.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

The Development Requires

03/02 2014

v1.4

1.4.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

04/12 2013

v1.3

1.3.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

04/12 2013

v1.2

1.2.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

03/12 2013

v1.1

1.1.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

02/12 2013

v1.0.1

1.0.1.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

MIT

The Requires

 

02/12 2013

v1.0

1.0.0.0

A PHP client library for ClamAV clamd daemon

  Sources   Download

The Requires