PHPackages                             rawnoq/laravel-form-data-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. rawnoq/laravel-form-data-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

rawnoq/laravel-form-data-parser
===============================

A Laravel package for parsing multipart/form-data requests

1.0.0(4mo ago)082MITPHPPHP ^8.2

Since Nov 12Pushed 4mo agoCompare

[ Source](https://github.com/rawnoq/laravel-form-data-parser)[ Packagist](https://packagist.org/packages/rawnoq/laravel-form-data-parser)[ RSS](/packages/rawnoq-laravel-form-data-parser/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Form Data Parser
========================

[](#laravel-form-data-parser)

A professional Laravel package for parsing `multipart/form-data` requests, especially useful for handling PUT, PATCH, and DELETE requests with file uploads.

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

[](#installation)

```
composer require rawnoq/laravel-form-data-parser
```

The package will be automatically discovered and registered by Laravel.

Features
--------

[](#features)

- ✅ Automatically parses `multipart/form-data` requests
- ✅ Supports nested form fields with bracket notation (e.g., `name[ar]`, `name[en]`, `items[0][name]`)
- ✅ Handles file uploads in PUT/PATCH/DELETE requests
- ✅ Converts flat keys to nested arrays automatically
- ✅ Robust error handling and edge case support
- ✅ Works seamlessly with Laravel's request handling
- ✅ Compatible with Laravel 11+ and Laravel 12+
- ✅ No configuration required

Usage
-----

[](#usage)

The package automatically registers a middleware that parses multipart/form-data requests. No configuration needed!

The middleware automatically:

- Parses multipart/form-data content
- Extracts form fields and files
- Converts bracket notation to nested arrays
- Makes data available via `$request->input()` and `$request->file()`

### Example

[](#example)

```
// In your controller
public function update(Request $request)
{
    // Access form data
    $name = $request->input('name');
    $nameAr = $request->input('name.ar'); // Nested notation
    $itemName = $request->input('items.0.name'); // Array notation

    // Access files
    $avatar = $request->file('avatar');
    $documents = $request->file('documents'); // Array of files

    // Process your request...
}
```

### Supported Form Field Formats

[](#supported-form-field-formats)

The package supports various form field formats:

```
// Simple fields
name=John

// Nested fields
name[ar]=جون
name[en]=John

// Array fields
items[0][name]=Item 1
items[1][name]=Item 2

// Mixed with files
avatar=file
name[ar]=جون
```

How It Works
------------

[](#how-it-works)

The middleware intercepts requests with `multipart/form-data` content type and:

1. Extracts the boundary from the request (multiple methods for reliability)
2. Parses each part of the multipart data
3. Identifies files vs regular form fields
4. Creates temporary files for uploaded files
5. Converts bracket notation to nested arrays
6. Merges parsed data into the request object
7. Handles errors gracefully without breaking the request

Supported Methods
-----------------

[](#supported-methods)

The middleware processes requests for methods other than:

- GET
- HEAD
- POST (Laravel handles this natively)

This means it works with:

- PUT
- PATCH
- DELETE
- And other custom methods

Error Handling
--------------

[](#error-handling)

The package includes comprehensive error handling:

- Invalid boundary detection with multiple fallback methods
- File creation errors are caught and handled
- Temporary file cleanup on errors
- Graceful degradation - if parsing fails, the request continues normally
- Debug logging in development mode

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+ or Laravel 12.0+

🧪 Testing
---------

[](#-testing)

The package comes with a comprehensive test suite:

```
# Run tests
composer test

# Run tests with coverage
composer test-coverage
```

### Test Coverage

[](#test-coverage)

The test suite includes:

- ✅ Form data parsing tests
- ✅ Nested fields and bracket notation tests
- ✅ File upload handling tests
- ✅ Middleware integration tests
- ✅ ServiceProvider registration tests
- ✅ Error handling tests

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE) file for details.

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

###  Health Score

36

—

LowBetter than 83% of packages

Maintenance76

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

129d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fef8f5b623783c112ea9b179c610918e020a18fe0e921a48dc45c351cb7b5115?d=identicon)[HassanHassanKerdash](/maintainers/HassanHassanKerdash)

---

Top Contributors

[![HassanHassanKerdash](https://avatars.githubusercontent.com/u/220541638?v=4)](https://github.com/HassanHassanKerdash "HassanHassanKerdash (1 commits)")

---

Tags

middlewarelaravelparsermultipartfile-uploadform-data

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rawnoq-laravel-form-data-parser/health.svg)

```
[![Health](https://phpackages.com/badges/rawnoq-laravel-form-data-parser/health.svg)](https://phpackages.com/packages/rawnoq-laravel-form-data-parser)
```

###  Alternatives

[bmatovu/laravel-xml

Laravel XML Support

91264.4k](/packages/bmatovu-laravel-xml)[tucker-eric/laravel-xml-middleware

A Laravel Middleware to accept XML requests

181.2M](/packages/tucker-eric-laravel-xml-middleware)[illuminatech/multipart-middleware

'multipart/form-data' parser middleware for Laravel

34261.2k](/packages/illuminatech-multipart-middleware)[json-mapper/laravel-package

The JsonMapper package for Laravel

25160.6k3](/packages/json-mapper-laravel-package)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

589.9k](/packages/sbsaga-toon)[illuminated/wikipedia-grabber

Wikipedia/MediaWiki Grabber for Laravel.

477.3k](/packages/illuminated-wikipedia-grabber)

PHPackages © 2026

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