PHP code example of narrowspark / http-emitter

1. Go to this page and download the library: Download narrowspark/http-emitter 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/ */

    

narrowspark / http-emitter example snippets




use Narrowspark\HttpEmitter\SapiEmitter;

$response = new \Response();
$response->getBody()->write("some content\n");

$emitter = new SapiEmitter();
$emitter->emit($response);



use Narrowspark\HttpEmitter\Util;

$response = new \Response();

$response = Util::injectContentLength($response);
echo