Skip to content
PHP parser for HTTP multipart/form-data bodies
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
README.md
composer.json
composer.lock
phpstan.neon.dist
phpunit.xml.dist

README.md

PHP parser for HTTP multipart/form-data bodies

Parses HTTP bodies encoded as multipart/form-data.

Install

You can install this package via Composer:

composer kekos/multipart-form-data-parser

Documentation

Usage with existing PSR-7 request

<?php
use Kekos\MultipartFormDataParser\Parser;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;

/** @var ServerRequestInterface $request */
/** @var UploadedFileFactoryInterface $uploaded_file_factory */
/** @var StreamFactoryInterface $stream_factory */
$parser = Parser::createFromRequest($request, $uploaded_file_factory, $stream_factory);
$parser->decorateRequest($request);

$post_fields = $request->getParsedBody();
$files = $request->getUploadedFiles();

Bugs and improvements

Report bugs in GitHub issues or feel free to make a pull request :-)

License

MIT

You can’t perform that action at this time.