create-psr7-http-message
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "create-psr7-http-message":https://skillpi.com/zh/skills/deepskill-442064d51da3c5ca2879b317791858957afa4ce1eee6d1e25f94fd60a21b99af。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为 PHP 8.4 生成符合 PSR-7 的 HTTP 消息实现。创建不可变的 Request、Response、Stream、Uri 和 ServerRequest 类,并包含单元测试以验证行为。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: create-psr7-http-message
description: Generates PSR-7 HTTP Message implementations for PHP 8.4. Creates Request, Response, Stream, Uri, and ServerRequest classes with immutability. Includes unit tests.PSR-7 HTTP Message Generator
Overview
Generates PSR-7 compliant HTTP message implementations following Psr\Http\Message interfaces.
When to Use
- Building custom HTTP framework
- Creating lightweight HTTP message handling
- Need for immutable request/response objects
- Testing HTTP interactions
Generated Components
| Component | Interface | Location |
|---|---|---|
| Request | RequestInterface |
src/Infrastructure/Http/Message/ |
| Response | ResponseInterface |
src/Infrastructure/Http/Message/ |
| ServerRequest | ServerRequestInterface |
src/Infrastructure/Http/Message/ |
| Stream | StreamInterface |
src/Infrastructure/Http/Message/ |
| Uri | UriInterface |
src/Infrastructure/Http/Message/ |
| UploadedFile | UploadedFileInterface |
src/Infrastructure/Http/Message/ |
Quick Template: Response
<?php
declare(strict_types=1);
namespace App\Infrastructure\Http\Message;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
final readonly class Response implements ResponseInterface
{
private const PHRASES = [
200 => 'OK', 201 => 'Created', 204 => 'No Content',
400 => 'Bad Request', 401 => 'Unauthorized', 403 => 'Forbidden',
404 => 'Not Found', 500 => 'Internal Server Error',
];
public function __construct(
private int $statusCode = 200,
private string $reasonPhrase = '',
private array $headers = [],
private StreamInterface $body = new Stream(''),
private string $protocolVersion = '1.1',
) {}
public function getStatusCode(): int { return $this->statusCode; }
public function getReasonPhrase(): string { return $this->reasonPhrase; }
public function getHeaders(): array { return $this->headers; }
public function getBody(): StreamInterface { return $this->body; }
public function withStatus(int $code, string $reasonPhrase = ''): static
{
return new self($code, $reasonPhrase ?: (self::PHRASES[$code] ?? ''),
$this->headers, $this->body, $this->protocolVersion);
}
public function withHeader(string $name, $value): static
{
$headers = $this->headers;
$headers[strtolower($name)] = is_array($value) ? $value : [$value];
return new self($this->statusCode, $this->reasonPhrase, $headers,
$this->body, $this->protocolVersion);
}
public function withBody(StreamInterface $body): static
{
return new self($this->statusCode, $this->reasonPhrase,
$this->headers, $body, $this->protocolVersion);
}
// ... other MessageInterface methods
}
Usage Example
<?php
use App\Infrastructure\Http\Message\Response;
use App\Infrastructure\Http\Message\Stream;
// Create response
$response = new Response(200);
$response = $response
->withHeader('Content-Type', 'application/json')
->withBody(new Stream(json_encode(['status' => 'ok'])));
// Read response
echo $response->getStatusCode(); // 200
echo $response->getHeaderLine('Content-Type'); // application/json
echo (string) $response->getBody(); // {"status":"ok"}
Requirements
{
"require": {
"psr/http-message": "^2.0"
}
}
See Also
references/templates.md- Full Response, Stream, Uri, Request, ServerRequest, UploadedFile templatesreferences/examples.md- Integration examples
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的 PSR-7 HTTP 消息实现生成能力,覆盖 Request、Response、Stream、Uri、ServerRequest 等核心组件
- 面向 PHP 开发者构建自定义 HTTP 框架的明确实用场景
- 包含不可变性设计和单元测试,提升代码质量
亮点
- description 精准描述生成 PSR-7 HTTP 消息实现的核心功能
- When to Use 章节清晰界定适用场景,边界明确
待提升项
-
文档长度略超推荐限制 原报告严重程度:轻微
文档内容约150行,略超过单文件500行的推荐限制
改进建议:建议将详细模板和示例拆分到引用文件中,保持主文档简洁
亮点
- 文档结构完整,包含 Overview、When to Use、组件表格、代码模板、使用示例等必要章节
- frontmatter 完整,符合规范要求
待提升项
-
异常处理覆盖不全 原报告严重程度:轻微
代码模板中未明确处理无效输入(如非法状态码)和文件上传相关异常
改进建议:建议在生成的代码中添加输入验证和异常处理机制,提升健壮性
亮点
- 提供了具体的 PHP 代码模板和明确的依赖要求(psr/http-message ^2.0)
- 代码结构符合 PSR-7 规范,包含不可变性实现和状态码短语映射
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。