Custom Laravel 5 anti-virus validator for file uploads.
You must have ClamAV anti-virus scanner running on the server to make this package work.
You can see the ClamAV installation instructions on the official ClamAV documentation.
For example on an Ubuntu machine, you can do:
# 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.
Install the package through Composer.
Run composer require crys/laravel-clamav
Add the following to your providers
array in config/app.php
:
'providers' => [
// ...
Crys\Clamav\ServiceProvider::class,
],
Use it like any Validator
rule:
$rules = [
'my_file_field' => 'clamav',
];
By default the package will try to connect the clamav daemon via the default unix socket (/var/run/clamav/clamd.ctl
)
But you can set the CLAMAV_HOST
environment variable to override this.