/fuse-php:php-http-psrfrom fuse-php
Covers PSR-7/15/17/18 HTTP standards for framework-agnostic PHP HTTP code: immutable messages, middleware pipelines, factories, and clients. Includes guidance on reference implementations and a middleware-pipeline template.
Ships in fuse-php. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Includes guidance on reference implementations (nyholm/psr7, guzzlehttp/psr7, laminas-diactoros) and how to choose between them, plus a complete middleware-pipeline template.
Do NOT use this skill for Laravel's own HTTP layer (route to laravel-expert instead) or for Symfony's HttpFoundation component, which is a different, non-PSR-7 HTTP model — bridge the two via symfony/psr-http-message-bridge when needed (see references/implementations.md).
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
After implementation, run fuse-ai-pilot:sniper for validation.
These four PSR standards let libraries handle HTTP without coupling to any framework. Code depends on interfaces (Psr\Http\*); a concrete implementation is injected.
| Standard | Package | Provides |
|---|---|---|
| PSR-7 | psr/http-message | Immutable HTTP messages: MessageInterface, RequestInterface, ResponseInterface, ServerRequestInterface, StreamInterface, UriInterface, UploadedFileInterface |
| PSR-15 | psr/http-server-handler + psr/http-server-middleware | RequestHandlerInterface, MiddlewareInterface — the middleware pipeline |
| PSR-17 | psr/http-factory | Factories that create PSR-7 objects without naming a concrete class |
| PSR-18 | psr/http-client | ClientInterface::sendRequest() — send a PSR-7 request, get a PSR-7 response |
with*() returns a NEW instance; the original is unchanged. $r->withHeader(...) alone is a no-op — reassign.ResponseInterface, inject a ResponseFactoryInterface. NEVER new Response() inside reusable code.StreamInterface wraps a real resource; use read-only streams for requests/responses.NetworkExceptionInterface) or malformed requests (RequestExceptionInterface).getHeaderLine('foo') == getHeaderLine('FOO'); original case is preserved in getHeaders().src/
├── Http/
│ ├── Middleware/ # implements Psr\Http\Server\MiddlewareInterface
│ │ ├── ErrorHandlerMiddleware.php
│ │ └── AuthMiddleware.php
│ ├── Handler/ # implements Psr\Http\Server\RequestHandlerInterface
│ │ └── Dispatcher.php # the pipeline runner
│ └── Client/ # wraps a Psr\Http\Client\ClientInterface
└── interfaces/ # your own contracts (SOLID)
→ See middleware-pipeline.md for a complete runnable pipeline
| Topic | Reference | When to Consult |
|---|---|---|
| Messages | psr7-messages.md | Reading/building requests, responses, streams, URIs |
| Middleware | psr15-middleware.md | Building a middleware + handler pipeline |
| Factories | psr17-factories.md | Creating PSR-7 objects implementation-agnostically |
| HTTP Client | psr18-client.md | Sending outbound requests, exception handling |
| Implementations | implementations.md | Choosing nyholm / guzzle / laminas + PSR-18 clients |
| Template | When to Use |
|---|---|
| middleware-pipeline.md | Building a PSR-15 dispatcher with middleware queue |
$response = $response
->withStatus(201)
->withHeader('Content-Type', 'application/json');
final class AuthMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (!$request->hasHeader('Authorization')) {
return $this->responseFactory->createResponse(401);
}
return $handler->handle($request);
}
}
$request = $requestFactory->createRequest('GET', 'https://api.example.com');
$request = $request->withBody($streamFactory->createStream('{"ping":true}'));
→ See psr17-factories.md for all six factory interfaces
ResponseFactoryInterface so middleware never names a concrete classnyholm/psr7 when you want a lightweight, strict PSR-7 + PSR-17 in one packagewith*() callwith*() returns a new objectHttpFoundation with PSR-7 — they are different; bridge via symfony/psr-http-message-bridgenew GuzzleHttp\Psr7\Response() in library code — depend on the factoryreferences/implementations.md (opens in a new tab)references/psr15-middleware.md (opens in a new tab)references/psr17-factories.md (opens in a new tab)references/psr18-client.md (opens in a new tab)references/psr7-messages.md (opens in a new tab)references/templates/middleware-pipeline.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fusengine/claude-plugins --plugin fuse-php6 skills in this plugin
/php-ecosystem-referenceUse when picking a non-Laravel PHP tool — Symfony components, API Platform, or Slim — and routing to implementation. Do NOT use for Laravel (laravel-expert)./php-language-modernUse when writing modern non-framework PHP 8.1-8.5 — property hooks, asymmetric visibility, pipe operator, attributes, enums, readonly. Do NOT use for style (php-standards) or Laravel./php-quality-toolingUse when setting up PHPStan, Rector, or PHP-CS-Fixer on a non-Laravel PHP project, incl. CI wiring. Do NOT use for Laravel (Pint/Larastan), tests, or syntax.Other plugins' skills for the same job