Download the PHP package robbie/psr7-adapters without Composer
On this page you can find all versions of the php package robbie/psr7-adapters. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robbie/psr7-adapters
More information about robbie/psr7-adapters
Files in robbie/psr7-adapters
Package psr7-adapters
Short Description PSR-7 compliant adapters for SilverStripe HTTP classes
License BSD-3-Clause
Informations about the package psr7-adapters
robbie/psr7-adapters
PSR-7 compliant, immutable adapter interfaces for SilverStripe HTTP classes.
Requirements
silverstripe/framework
^4.0guzzlehttp/psr7
Installation
Install with Composer:
Add ?flush=1
to your browser URL, flush=1
to your sake
command arguments or --flush
to your ssconsole
.
Use
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 theRobbie\Psr7\HttpRequestAdapter
classHTTPResponse
uses theRobbie\Psr7\HttpResponseAdapter
class
To retrieve a bootstrapped PSR-7 ServerRequestInterface
or ResponseInterface
you can call ->toPsr7($request)
on either of these classes, for example:
From here you can use any of the PSR-7 interface methods, and the results will be immutable:
The same concept applies to the HttpRequestAdapter
, for example:
Converting from PSR-7
To return a PSR-7 interface back to either an HTTPRequest
or HTTPResponse
class you simply need to do the same thing as going to, only use ->fromPsr7($input)
instead:
$httpRequest
is now a SilverStripe\Control\HTTPRequest
instance.
All versions of psr7-adapters with dependencies
silverstripe/framework Version ^4.0 || ^5.0
guzzlehttp/psr7 Version ^1.3 || ^2.0