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

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

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

amphp/http-server-form-parser

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固