kekos / multipart-form-data-parser
PHP parser for HTTP multipart/form-data bodies
Installs: 13 899
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0 || ^2.0
Requires (Dev)
- nyholm/psr7: ^1.2
- phpstan/phpstan: ^1.8
- phpstan/phpstan-phpunit: ^1.1
- phpunit/phpunit: ^10.5
- rector/rector: ^0.18
README
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