1. Go to this page and download the library: Download robbie/psr7-adapters library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
robbie / psr7-adapters example snippets
$myResponse = new \SilverStripe\Control\HTTPResponse(
json_encode(['success' => true, 'message' => 'Your request was successful!']),
200,
'OK'
);
/** @var \Psr\Http\Message\ResponseInterface $response */
$response = (new \Robbie\Psr7\HttpResponseAdapter)->toPsr7($myResponse);