ClamAV integration for Laravel 5.5+
, (*1)
Custom Laravel 5 anti-virus validator for file uploads., (*2)
Requirements
You must have ClamAV anti-virus scanner running on the server to make this package work., (*3)
You can see the ClamAV installation instructions on the official ClamAV documentation., (*4)
For example on an Ubuntu machine, you can do:, (*5)
# Install clamav virus scanner
sudo apt update && apt install -y clamav-daemon
# Update virus definitions
sudo freshclam
# Start the scanner service
sudo systemctl enable --now clamav-daemon clamav-freshclam
This package is not tested on windows, but if you have ClamAV running (usually on port 3310) it should work., (*6)
Installation
Install the package through Composer., (*7)
Run composer require crys/laravel-clamav
, (*8)
Add the following to your providers
array in config/app.php
:, (*9)
'providers' => [
// ...
Crys\Clamav\ServiceProvider::class,
],
Usage
Use it like any Validator
rule:, (*10)
$rules = [
'my_file_field' => 'clamav',
];
Configuration
By default the package will try to connect the clamav daemon via the default unix socket (/var/run/clamav/clamd.ctl
), (*11)
But you can set the CLAMAV_HOST
environment variable to override this., (*12)