PHP code example of danharper / psr7-jsonx

1. Go to this page and download the library: Download danharper/psr7-jsonx 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/ */

    

danharper / psr7-jsonx example snippets


$jsonxAdaptor = new JSONxPSR7(new DiactorosStreamFactory);

// or instead of DiactorosStreamFactory, implement your own, or use:

$streamFactory = new CallableStreamFactory(function($body) { return MyPsr7Stream::fromString($body); });
$jsonxAdaptor = new JSONxPSR7($streamFactory);

$request = $jsonxAdaptor->request($request);

$response = $jsonxAdaptor->response($request, $response);