承接 effectra/http-foundation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

effectra/http-foundation

最新稳定版本:v1.0.4

Composer 安装命令:

composer require effectra/http-foundation

包简介

The Effectra HTTP Foundation package.

README 文档

README

Effectra\Http\Foundation is a package that provides foundation classes for handling HTTP requests and responses.

Installation

You can install this package via Composer. Run the following command in your terminal:

composer require effectra/http-foundation

Classes

The package includes the following classes:

RequestFoundation

The RequestFoundation class provides a foundation for creating PSR-7 compliant server request objects from PHP's global variables.

Usage

use Effectra\Http\Foundation\RequestFoundation;
use Effectra\Contracts\Http\RequestFoundationInterface;

// Create a server request object from globals
$request = RequestFoundation::createFromGlobals();

// Access request attributes, query parameters, etc.
$path = $request->getUri()->getPath();
$queryParams = $request->getQueryParams();

// ... Add your code to handle the request ...

ResponseFoundation

The ResponseFoundation class provides a foundation for sending PSR-7 compliant response objects.

Usage

use Effectra\Http\Foundation\ResponseFoundation;
use Effectra\Contracts\Http\ResponseFoundationInterface;

// Create a response object
$response = new ResponseFoundation($content, $statusCode, $headers);

// Send the response
ResponseFoundation::send($response);

UploadedFileFoundation

The UploadedFileFoundation class provides a foundation for representing uploaded files in HTTP requests.

Usage

use Effectra\Http\Foundation\UploadedFileFoundation;
use Effectra\Contracts\Http\UploadedFileFoundationInterface;

// Create an uploaded file object
$uploadedFile = new UploadedFileFoundation($stream, $size, $error, $clientFilename, $clientMediaType);

// Access uploaded file properties
$stream = $uploadedFile->getStream();
$size = $uploadedFile->getSize();
$error = $uploadedFile->getError();
$clientFilename = $uploadedFile->getClientFilename();
$clientMediaType = $uploadedFile->getClientMediaType();

// ... Add your code to handle the uploaded file ...

Contributing

Contributions are welcome! If you have any bug reports, feature requests, or suggestions, please open an issue on the GitHub repository.

License

This package is open-source software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-19