定制 cryodrift/fakepost 二次开发

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

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

cryodrift/fakepost

最新稳定版本:0.1.30

Composer 安装命令:

composer require cryodrift/fakepost

包简介

Fake POST from file to simulate incoming requests for testing.

README 文档

README

Overview

The Fakepost middleware is a utility for simulating POST requests by loading data from files. It's primarily designed for testing and development purposes, allowing developers to easily mock POST requests without needing to set up complex test environments.

Components

Cli Handler

The Cli.php component is the main handler that processes POST requests in CLI mode. It:

  • Intercepts POST requests
  • Parses POST data from files
  • Sets the parsed data as request variables

ParamPost

The ParamPost.php component extends the system's ParamFile class to handle POST parameters. It:

  • Loads POST data from files
  • Handles special cases like empty values

Usage

Command Line

The middleware is automatically registered when running in CLI mode. To use it:

  1. Create a text file with your POST data in the format:

    key1: value1
    key2: value2
    
  2. Pass this file as a parameter to your CLI command:

    php index.php /your/endpoint -post=path/to/postdata.txt
    
  3. The middleware will parse the file and set the key-value pairs as POST variables in the request.

Example

Given a file postdata.txt with the content:

username: testuser
password: testpass

Running:

php index.php /login -post=postdata.txt

Will simulate a POST request to /login with the username and password parameters.

Configuration

The middleware is automatically registered in CLI mode through the config.php file. No additional configuration is required for basic usage.

Integration

The Fakepost middleware integrates with the system's request handling pipeline and works seamlessly with other components that process POST data.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固