notihnio / php-multipart-form-data-parser
缺失的php功能,用于支持 put、patch、delete、put FORM 和 MULTIPART 请求处理
2.1.0
2023-08-31 14:43 UTC
Requires
- php: >=8.1
- ext-mbstring: *
- illuminate/http: ^10.0
This package is auto-updated.
Last update: 2024-08-30 02:02:46 UTC
README
缺失的php功能,用于支持 put、patch、delete、put、FORM 和 MULTIPART 请求处理
此包是 notihnio/php-request-parser (https://github.com/notihnio/php-request-parser)的一部分,该包提供对 PUT PATCH DELETE OPTIONS HEAD TRACE 请求的全支持
安装
composer require notihnio/php-multipart-form-data-parser:^2.0
用法
use Notihnio\MultipartFormDataParser;
$request = MultipartFormDataParser::parse();
//to access params use
$params = $request->params;
//to access uploaded files
$files = $request->files;
//to access headers use
$headers = $request->headers;
//to access cookies use
$cookies = $request->cookies;
支持 Symfony、Laravel 与 Swoole、Roadrunner 的结合使用
如果您想使用新版本的应用服务器如 Roadrunner 或 Swoole,强烈建议传递 Laravel 或 Symfony 请求实例作为参数,以避免内存泄漏
//laravel
use \Illuminate\Http\Request;
//$request found from controller
$parsedRequest = RequestParser::parse($request);
//symfony
use \Symfony\Component\HttpFoundation\Request
//$request found from controller
$parsedRequest = RequestParser::parse($request);
备选用法
use Notihnio\MultipartFormDataParser;
MultipartFormDataParser::parse();
//to access params
$params = $_PUT or ($_DELETE, $_PATCH etc.. according to the request type)
//to access uploaded files
$files = $_FILES
作者
- Notis Mastrandrikos
许可证
本项目采用 MIT 许可证授权