acc-create-psr7-http-message

Generates PSR-7 HTTP Message implementations for PHP 8.5. Creates Request, Response, Stream, Uri, and ServerRequest classes with immutability. Includes unit tests.

16 stars

Best use case

acc-create-psr7-http-message is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generates PSR-7 HTTP Message implementations for PHP 8.5. Creates Request, Response, Stream, Uri, and ServerRequest classes with immutability. Includes unit tests.

Teams using acc-create-psr7-http-message should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/acc-create-psr7-http-message/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/testing-security/acc-create-psr7-http-message/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/acc-create-psr7-http-message/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How acc-create-psr7-http-message Compares

Feature / Agentacc-create-psr7-http-messageStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generates PSR-7 HTTP Message implementations for PHP 8.5. Creates Request, Response, Stream, Uri, and ServerRequest classes with immutability. Includes unit tests.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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
<?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
<?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

```json
{
    "require": {
        "psr/http-message": "^2.0"
    }
}
```

## See Also

- `references/templates.md` - Full Response, Stream, Uri, Request, ServerRequest, UploadedFile templates
- `references/examples.md` - Integration examples

Related Skills

acc-create-value-object

16
from diegosouzapw/awesome-omni-skill

Generates DDD Value Objects for PHP 8.5. Creates immutable, self-validating objects with equality comparison. Includes unit tests.

acc-create-unit-test

16
from diegosouzapw/awesome-omni-skill

Generates PHPUnit unit tests for PHP 8.5. Creates isolated tests with AAA pattern, proper naming, attributes, and one behavior per test. Supports Value Objects, Entities, Services.

acc-create-test-double

16
from diegosouzapw/awesome-omni-skill

Generates test doubles (Mocks, Stubs, Fakes, Spies) for PHP 8.5. Creates appropriate double type based on testing needs with PHPUnit MockBuilder patterns.

acc-create-policy

16
from diegosouzapw/awesome-omni-skill

Generates Policy pattern for PHP 8.5. Creates encapsulated business rules for authorization, validation, and domain constraints. Includes unit tests.

acc-create-null-object

16
from diegosouzapw/awesome-omni-skill

Generates Null Object pattern for PHP 8.5. Creates safe default implementations eliminating null checks. Includes unit tests.

acc-create-command

16
from diegosouzapw/awesome-omni-skill

Generates CQRS Commands and Handlers for PHP 8.5. Creates immutable command DTOs with handlers that modify state. Includes unit tests.

doc-sys: Create System Requirements (Layer 6)

16
from diegosouzapw/awesome-omni-skill

Create System Requirements (SYS) - Layer 6 artifact defining functional requirements and quality attributes

create-prd

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks to "创建PRD", "写产品需求文档", "生成PRD", "新建PRD", "create PRD", "write product requirements document", or mentions "产品需求文档", "PRD模板". Automatically generates comprehensive Chinese PRD documents following 2026 best practices.

Create Jira Feature

16
from diegosouzapw/awesome-omni-skill

Implementation guide for creating Jira features representing strategic objectives and market problems

create-feature

16
from diegosouzapw/awesome-omni-skill

Creates Features following the T-Minus-15 process template. Features represent significant deliverables that contain multiple User Stories. Includes proper metadata, MoSCoW prioritization, effort estimates, deliverables, and benefit hypothesis.

create-feature-branch

16
from diegosouzapw/awesome-omni-skill

Create properly named feature branch from development with remote tracking, following WescoBar naming conventions and git best practices

create-sunpeak-app

16
from diegosouzapw/awesome-omni-skill

Use when working with sunpeak, or when the user asks to "build an MCP App", "build a ChatGPT App", "add a UI to an MCP tool", "create an interactive resource for Claude or ChatGPT", "build a React UI for an MCP server", or needs guidance on MCP App resources, tool-to-UI data flow, simulation files, host context, platform-specific ChatGPT/Claude features, or end-to-end testing of MCP App UIs.