定制 amphp/http-server-form-parser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amphp/http-server-form-parser

最新稳定版本:v2.0.0

Composer 安装命令:

composer require amphp/http-server-form-parser

包简介

An HTTP server plugin that simplifies form data handling. Effortlessly parse incoming form submissions and extracting its data.

README 文档

README

This package is an add-on to amphp/http-server, which allows parsing request bodies as forms in either x-www-form-urlencoded or multipart/form-data format.

Installation

This package can be installed as a Composer dependency.

composer require amphp/http-server-form-parser

Usage

Basic usage works by calling Form::fromRequest($request), which will buffer the request body and parse it. This method may be called multiple times, so both a middleware and request handler may access the form body.

use Amp\Http\Server\FormParser\Form; use Amp\Http\Server\Request; use Amp\Http\Server\RequestHandler\ClosureRequestHandler; use Amp\Http\Server\Response; use Amp\Http\Status; $requestHandler = new ClosureRequestHandler(function (Request $request) { $form = Form::fromRequest($request); return new Response(Status::OK, [ "content-type" => "text/plain; charset=utf-8" ], $form->getValue("text") ?? "Hello, World!"); });

There's also an advanced streaming parser included, StreamingFormParser, which can be used to stream uploaded files to disk or other locations.

统计信息

  • 总下载量: 83.28k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 8
  • 依赖项目数: 15
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 6
  • Forks: 4
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04