illuminatech/multipart-middleware
Laravel middleware that parses multipart/form-data requests for PUT, PATCH, and other non-POST methods, populating the request with regular input and uploaded files so you can handle file uploads on any HTTP verb.
Architecture fit: The package slots into Laravel's HTTP kernel as a request-mutating middleware, which is the idiomatic extension point for this problem. It targets a genuine PHP/Laravel gap: multipart/form-data bodies on PUT/PATCH requests are not natively hydrated into $request->files or $request->input(). If our product accepts non-POST uploads (e.g., REST-style PUT /documents/{id} with an attached file), this middleware is architecturally well-placed and low-blast-radius — it wraps the request before it reaches the controller.
Integration feasibility: High. It is a Composer-installable, self-contained middleware with no service-provider sprawl or database footprint. Registration is a one-line addition to app/Http/Kernel.php (or a route-group assignment). The main integration friction is verifying Laravel/PHP version support against our target runtime, since the package is not a first-party Laravel component and its version matrix is community-maintained.
Technical risk:
NOASSERTION is a red flag for legal. Composer may install it, but procurement/compliance must confirm the actual license text (likely MIT or BSD) before shipping.TrimStrings, ValidatePostSize, and any request-wrapping middleware like Laravel's own ValidateSignature) can interact with a request wrapper unexpectedly.Key questions to resolve before adoption:
Request contract (files, input, headers, has/get semantics) so downstream validation and form-request rules work unchanged?POST + _method spoofing, or a custom parser) that avoid the dependency entirely?Stack fit: Native fit for any Laravel application using standard HTTP kernel middleware. It requires no changes to controllers beyond what normal multipart handling would expect, and coexists with Laravel's request validation, form requests, and file-storage APIs — provided the wrapper satisfies the Illuminate\Http\Request contract.
Migration path: The lowest-risk path is additive: register the middleware only on routes that currently need PUT/PATCH uploads, rather than globally. This avoids any behavioral change to existing POST flows. If we currently work around the gap with _method spoofing or base64-encoded bodies, we can migrate route-by-route, with the workaround retained as a fallback until the new path is validated.
Compatibility:
composer.json.Sequencing:
$request->files, $request->input(), form-request validation, and error responses all behave.Maintenance: The dependency is small but externally maintained by a single contributor with an ambiguous license. Owning a fork is a realistic contingency; budget for periodic review of upstream commits and for a "vendored/patched" fallback. Given the narrow scope, a fork is low-effort to sustain if needed.
Support: Community-only — GitHub issues, no commercial backing. Internal documentation of the integration and a runbook for failure modes is essential. Assign an owner within the team.
Scaling: Primary concern is request body handling. Multipart parsing under concurrent large uploads directly affects memory and temp-disk I/O. Validate behavior against our PHP upload_max_filesize/post_max_size and Laravel's ValidatePostSize limits. If the parser buffers into memory, this becomes a denial-of-service surface under load and must be paired with strict size limits at the edge (reverse proxy/load balancer).
Failure modes:
Ramp-up: Low. The integration surface is one middleware registration plus request-shape verification — a competent Laravel engineer can be productive in under a day. The risk is not learning cost but the review burden: because community scrutiny is thin, we carry the verification effort ourselves, so plan a short internal test suite covering the edge cases above rather than relying on the package's own coverage.
How can I help you explore Laravel packages today?