PHPackages                             hosametm/file-scanning - 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. hosametm/file-scanning

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

hosametm/file-scanning
======================

A Laravel package for secure file scanning and validation

v1.0.1(10mo ago)111MITPHPPHP ^8.0

Since Aug 13Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/hosametm/file-scanning)[ Packagist](https://packagist.org/packages/hosametm/file-scanning)[ Docs](https://github.com/hosametm/file-scanning)[ RSS](/packages/hosametm-file-scanning/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

File Scanning Package
=====================

[](#file-scanning-package)

A Laravel package for secure file scanning and validation. This package helps you validate files based on their MIME types and provides protection against potentially malicious file uploads.

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

[](#installation)

You can install the package via composer:

```
composer require hosametm/file-scanning
```

After installing the package, publish the configuration file:

```
php artisan vendor:publish --tag=file-scanning-config
```

Configuration
-------------

[](#configuration)

The configuration file (`config/file-scanning.php`) contains three main sections:

1. `temp_directory`: The directory where temporary files will be stored when downloading files from URLs (defaults to system temp directory)
2. `mime_types`: A list of allowed file extensions and their corresponding MIME types
3. `malicious_mime_types`: A list of MIME types that are considered potentially malicious

You can customize these settings according to your needs.

Usage
-----

[](#usage)

### Basic Usage with File Uploads

[](#basic-usage-with-file-uploads)

```
use Hosametm\FileScanning\FileScanner;

class YourController extends Controller
{
    protected $fileScanner;

    public function __construct(FileScanner $fileScanner)
    {
        $this->fileScanner = $fileScanner;
    }

    public function upload(Request $request)
    {
        $file = $request->file('file');

        if ($this->fileScanner->validateUpload($file)) {
            // File is valid, proceed with upload
        } else {
            // File is invalid or potentially malicious
        }
    }
}
```

### Validating Files from URLs

[](#validating-files-from-urls)

```
use Hosametm\FileScanning\FileScanner;

class YourController extends Controller
{
    protected $fileScanner;

    public function __construct(FileScanner $fileScanner)
    {
        $this->fileScanner = $fileScanner;
    }

    public function validateUrl(Request $request)
    {
        $url = $request->input('file_url');

        if ($this->fileScanner->validateUrl($url)) {
            // File from URL is valid, proceed with processing
        } else {
            // File is invalid or potentially malicious
        }
    }
}
```

### Available Methods

[](#available-methods)

#### Validate a File Path

[](#validate-a-file-path)

```
$fileScanner->validate(string $filePath): bool
```

#### Validate an Uploaded File

[](#validate-an-uploaded-file)

```
$fileScanner->validateUpload(\Illuminate\Http\UploadedFile $file): bool
```

#### Validate a File from URL

[](#validate-a-file-from-url)

```
$fileScanner->validateUrl(string $url): bool
```

#### Get File MIME Type

[](#get-file-mime-type)

```
$fileScanner->getMimeType(string $filePath): ?string
```

#### Check if File is Malicious

[](#check-if-file-is-malicious)

```
$fileScanner->isMalicious(string $filePath): bool
```

#### Get Extensions from MIME Type

[](#get-extensions-from-mime-type)

```
$fileScanner->getExtensionsFromMimeType(string $mimeType): array
```

Security
--------

[](#security)

This package helps protect your application by:

- Validating file MIME types
- Blocking potentially malicious file types
- Providing a configurable whitelist of allowed file types
- Securely handling file uploads and URL downloads
- Automatically cleaning up temporary files

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance53

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

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

324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17b21f6cd18376eb3517d7bc5a95f3204f9e1836bece3250f8f75d91a81b03ac?d=identicon)[hosametm](/maintainers/hosametm)

---

Top Contributors

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

---

Tags

laravelvalidationsecuritymime-typefilescanning

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hosametm-file-scanning/health.svg)

```
[![Health](https://phpackages.com/badges/hosametm-file-scanning/health.svg)](https://phpackages.com/packages/hosametm-file-scanning)
```

###  Alternatives

[unisharp/laravel-filemanager

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

2.2k3.5M85](/packages/unisharp-laravel-filemanager)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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