create-psr7-http-message
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-psr7-http-message" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-442064d51da3c5ca2879b317791858957afa4ce1eee6d1e25f94fd60a21b99af. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generate a PSR-7 HTTP message implementation for PHP 8.4. Create immutable Request, Response, Stream, Uri, and ServerRequest classes and include unit tests to validate behavior.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Generates PSR-7 HTTP Message implementations for PHP 8.4. Creates Request, Response, Stream, Uri, and ServerRequest classes with immutability. Includes unit tests.
- Audience
- Building custom HTTP framework Creating lightweight HTTP message handling Need for immutable request/response objects Testing HTTP interactions
- Testing
- Not tested
Browse files
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
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 PSR-7 HTTP 消息实现生成能力,覆盖 Request、Response、Stream、Uri、ServerRequest 等核心组件
- 面向 PHP 开发者构建自定义 HTTP 框架的明确实用场景
- 包含不可变性设计和单元测试,提升代码质量
Highlights
- description 精准描述生成 PSR-7 HTTP 消息实现的核心功能
- When to Use 章节清晰界定适用场景,边界明确
Areas to improve
-
文档长度略超推荐限制 Reported severity: Minor
文档内容约150行,略超过单文件500行的推荐限制
Recommendation: 建议将详细模板和示例拆分到引用文件中,保持主文档简洁
Highlights
- 文档结构完整,包含 Overview、When to Use、组件表格、代码模板、使用示例等必要章节
- frontmatter 完整,符合规范要求
Areas to improve
-
异常处理覆盖不全 Reported severity: Minor
代码模板中未明确处理无效输入(如非法状态码)和文件上传相关异常
Recommendation: 建议在生成的代码中添加输入验证和异常处理机制,提升健壮性
Highlights
- 提供了具体的 PHP 代码模板和明确的依赖要求(psr/http-message ^2.0)
- 代码结构符合 PSR-7 规范,包含不可变性实现和状态码短语映射
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.