PHPackages                             jord-jd/laravel-malware-validation-rule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. jord-jd/laravel-malware-validation-rule

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

jord-jd/laravel-malware-validation-rule
=======================================

Scans uploaded files for viruses and other malware

v2.1.0(1mo ago)401LGPL-3.0-onlyPHPPHP &gt;=7.2CI passing

Since Mar 14Pushed 1mo agoCompare

[ Source](https://github.com/Jord-JD/laravel-malware-validation-rule)[ Packagist](https://packagist.org/packages/jord-jd/laravel-malware-validation-rule)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/jord-jd-laravel-malware-validation-rule/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Laravel Malware Validation Rule
===============================

[](#laravel-malware-validation-rule)

The Laravel Malware Validation Rule package provides a validation rule that scans uploaded files for viruses and other malware.

Supports Laravel 5.1 through 13 and PHP 7.2 through current releases.

Installation
------------

[](#installation)

To install the Laravel Malware Validation Rule package, run the following command

```
composer require jord-jd/laravel-malware-validation-rule
```

This package makes use of the ClamAV daemon to perform virus/malware scanning. You can install ClamAV in Ubuntu/Debian with the following command.

```
sudo apt install clamav-daemon
```

Your ClamAV installation should automatically update virus defintions. However, you can update your ClamAV virus definitions manually using the `freshclam` command. It is recommended to restart the ClamAV daemon after the virus definitions have been updated to ensure they take effect.

```
sudo freshclam
sudo service clamav-daemon restart
```

Usage
-----

[](#usage)

See the following basic usage example, which demonstrates how to validate a basic file upload does not contain contain a known virus/malware.

```
use \JordJD\LaravelMalwareValidationRule\Rules\Malware;

// ...

public function rules()
{
    return [
        'my_file' => ['required', 'file', new Malware()],
    ];
}
```

For non-default ClamAV installations, inject a configured scanner. Unix sockets and TCP socket URIs are supported by the underlying client:

```
use JordJD\LaravelMalwareValidationRule\Scanner;

$scanner = new Scanner('tcp://clamav.internal:3310', 10);
$rule = new Malware(true, $scanner);
```

Connection, daemon, and unreadable-file failures are normalised to `MalwareScanFailedException`; applications can report or retry these separately from an infected-file validation failure.

By default the validation rule message will include the name of the detected virus/malware. If you do not wish the malware name to be shown in the validation message you can turn this off as shown below.

```
public function rules()
{
    $showMalwareName = false;

    return [
        'my_file' => ['required', 'file', new Malware($showMalwareName)],
    ];
}
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance94

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1158 days

Total

3

Last Release

30d ago

Major Versions

v1.0.0 → v2.0.02026-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (31 commits)")

---

Tags

laravel-packagemalwarephp-libraryvalidationvirus

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jord-jd-laravel-malware-validation-rule/health.svg)

```
[![Health](https://phpackages.com/badges/jord-jd-laravel-malware-validation-rule/health.svg)](https://phpackages.com/packages/jord-jd-laravel-malware-validation-rule)
```

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

137236.2k8](/packages/statamic-rad-pack-runway)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3622.8k](/packages/duncanmcclean-statamic-cargo)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21327.3k4](/packages/ecotone-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
