Download the PHP package rawnoq/laravel-form-data-parser without Composer
On this page you can find all versions of the php package rawnoq/laravel-form-data-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rawnoq/laravel-form-data-parser
More information about rawnoq/laravel-form-data-parser
Files in rawnoq/laravel-form-data-parser
Package laravel-form-data-parser
Short Description A Laravel package for parsing multipart/form-data requests
License MIT
Informations about the package 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
The package will be automatically discovered and registered by Laravel.
Features
- ✅ Automatically parses
multipart/form-datarequests - ✅ 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
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
Supported Form Field Formats
The package supports various form field formats:
How It Works
The middleware intercepts requests with multipart/form-data content type and:
- Extracts the boundary from the request (multiple methods for reliability)
- Parses each part of the multipart data
- Identifies files vs regular form fields
- Creates temporary files for uploaded files
- Converts bracket notation to nested arrays
- Merges parsed data into the request object
- Handles errors gracefully without breaking the request
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
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
- PHP 8.2+
- Laravel 11.0+ or Laravel 12.0+
🧪 Testing
The package comes with a comprehensive test suite:
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
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
All versions of laravel-form-data-parser with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
symfony/http-foundation Version ^7.0