PHPackages                             robbie/psr7-adapters - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. robbie/psr7-adapters

ActiveSilverstripe-vendormodule[HTTP &amp; Networking](/categories/http)

robbie/psr7-adapters
====================

PSR-7 compliant adapters for SilverStripe HTTP classes

1.0.3(3y ago)116.9k↓27.3%6[2 issues](https://github.com/robbieaverill/psr7-adapters/issues)2BSD-3-ClausePHPPHP &gt;=5.6.0CI passing

Since Jan 13Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/robbieaverill/psr7-adapters)[ Packagist](https://packagist.org/packages/robbie/psr7-adapters)[ RSS](/packages/robbie-psr7-adapters/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (2)

robbie/psr7-adapters
====================

[](#robbiepsr7-adapters)

[![CI](https://github.com/robbieaverill/psr7-adapters/actions/workflows/ci.yml/badge.svg)](https://github.com/robbieaverill/psr7-adapters/actions/workflows/ci.yml)

PSR-7 compliant, immutable adapter interfaces for SilverStripe HTTP classes.

Requirements
------------

[](#requirements)

- `silverstripe/framework` ^6.0
- `guzzlehttp/psr7`
- PHP ^8.3

Installation
------------

[](#installation)

Install with [Composer](https://getcomposer.org):

```
composer require robbie/psr7-adapters
```

Add `?flush=1` to your browser URL, `flush=1` to your `sake` command arguments or `--flush` to your [`ssconsole`](https://github.com/silverleague/silverstripe-console).

Use
---

[](#use)

### Converting to PSR-7

[](#converting-to-psr-7)

This module works by providing either a `HTTPRequest` or a `HTTPResponse` class that is pre-configured and ready to be sent to the client/server to the corresponding adapter class:

- `HTTPRequest` uses the `Robbie\Psr7\HttpRequestAdapter` class
- `HTTPResponse` uses the `Robbie\Psr7\HttpResponseAdapter` class

To retrieve a bootstrapped PSR-7 `ServerRequestInterface` or `ResponseInterface` you can call `->toPsr7($request)` on either of these classes, for example:

```
