PHPackages                             portavice/laravel-filesanitizer - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. portavice/laravel-filesanitizer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

portavice/laravel-filesanitizer
===============================

Laravel integration for sytxlabs/filesanitizer

1.0.1(1mo ago)048↑775%1[2 PRs](https://github.com/portavice/laravel-filesanitizer/pulls)MITPHPPHP ^8.1CI failing

Since Mar 16Pushed 1mo agoCompare

[ Source](https://github.com/portavice/laravel-filesanitizer)[ Packagist](https://packagist.org/packages/portavice/laravel-filesanitizer)[ RSS](/packages/portavice-laravel-filesanitizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (4)Used By (0)

Laravel FileSanitizer
=====================

[](#laravel-filesanitizer)

[![MIT Licensed](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Check code style](https://github.com/portavice/laravel-filesanitizer/actions/workflows/code-style.yml/badge.svg?style=flat-square)](https://github.com/portavice/laravel-filesanitizer/actions/workflows/code-style.yml)[![Tests](https://github.com/portavice/laravel-filesanitizer/actions/workflows/tests.yml/badge.svg?style=flat-square)](https://github.com/portavice/laravel-filesanitizer/actions/workflows/code-style.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/be9eec606f3e359298f29d5f767d4a784be920c79a43823bd9b8102ba930ce33/68747470733a2f2f706f7365722e707567782e6f72672f706f727461766963652f6c61726176656c2d66696c6573616e6974697a65722f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/portavice/laravel-filesanitizer)[![Total Downloads](https://camo.githubusercontent.com/2a9e627129cf2e1285d9025dc7164c28bc4eedea2374c538b6c731af21bea38e/68747470733a2f2f706f7365722e707567782e6f72672f706f727461766963652f6c61726176656c2d66696c6573616e6974697a65722f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/portavice/laravel-filesanitizer)

Laravel integration for [`sytxlabs/filesanitizer`](https://github.com/SytxLabs/FileSanitizer).

The upstream package is installed as `sytxlabs/filesanitizer` and uses the class `SytxLabs\FileSanitizer\FileSanitizer`.

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

[](#installation)

```
composer require portavice/laravel-filesanitizer
php artisan vendor:publish --tag=filesanitizer-config
```

Usage
-----

[](#usage)

```
use Portavice\LaravelFileSanitizer\Facades\FileSanitizer;

$result = FileSanitizer::process(storage_path('app/uploads/file.pdf'), null, true);

if (! FileSanitizer::safe($result)) {
    foreach (FileSanitizer::issues($result) as $issue) {
        echo is_object($issue) ? $issue->code : ($issue['code'] ?? 'unsafe');
        echo PHP_EOL;
    }
}
```

Validation rule
---------------

[](#validation-rule)

```
use Portavice\LaravelFileSanitizer\Rules\SafeFile;

$request->validate([
    'upload' => ['required', 'file', new SafeFile()],
]);
```

Or as a validator string rule:

```
$request->validate([
    'upload' => ['required', 'file', 'safe_file'],
]);
```

UploadedFile macro
------------------

[](#uploadedfile-macro)

```
$result = $request->file('upload')->sanitize();
```

Config
------

[](#config)

```
return [
    'sanitize_always' => env('FILESANITIZER_SANITIZE_ALWAYS', false),
];
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance89

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~0 days

Total

2

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/114071541?v=4)[portavice GmbH](/maintainers/portavice)[@portavice](https://github.com/portavice)

---

Top Contributors

[![shaunluedeke](https://avatars.githubusercontent.com/u/77498048?v=4)](https://github.com/shaunluedeke "shaunluedeke (7 commits)")

---

Tags

file-sanitizationfile-securityfilesanitizerlaravelphpupload-securityxss-protection

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/portavice-laravel-filesanitizer/health.svg)

```
[![Health](https://phpackages.com/badges/portavice-laravel-filesanitizer/health.svg)](https://phpackages.com/packages/portavice-laravel-filesanitizer)
```

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[galahad/laravel-addressing

Laravel package providing addressing functionality

70316.6k](/packages/galahad-laravel-addressing)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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