utopia-php / psr7
PSR-7 HTTP message implementations and PSR-17 factories for Utopia
0.2.0
2026-07-06 12:40 UTC
Requires
- php: >=8.4
- psr/http-factory: ^1.0
- psr/http-message: ^1.1 || ^2.0
Suggests
- ext-simplexml: Required to decode XML responses with Response::xml().
README
Important
This repository is a read-only mirror of the utopia-php monorepo. Development happens in packages/psr7 — please open issues and pull requests there.
PSR-7 HTTP message implementations and PSR-17 factories for PHP 8.4+.
Install
composer require utopia-php/psr7
Quick Start
<?php use Utopia\Psr7\Method; use Utopia\Psr7\Request; use Utopia\Psr7\Response; use Utopia\Psr7\Stream; require __DIR__ . '/vendor/autoload.php'; $request = new Request\Factory()->json(Method::POST, 'https://example.com/users', [ 'name' => 'Ada', ]); $response = new Response(200, body: new Stream('{"ok":true}')); echo $request->getMethod(); echo $response->json()['ok'];
The package includes immutable request, response, URI, and stream implementations, plus helpers for JSON, XML, text, form, query-string, raw-body, and multipart payloads.
Development
Local copies of the relevant PSR and multipart RFC documents live under docs/, with translated coverage requirements in testing-requirements.md.