PHP code example of davidecesarano / embryo-emitter

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

    

davidecesarano / embryo-emitter example snippets


use Embryo\Http\Factory\ResponseFactory;
use Embryo\Http\Emitter\Emitter;

$response = (new ResponseFactory)->createResponse(200);
$emitter  = new Emitter;

$body = $response->getBody();
$body->write('Hello World!');
$response = $response->withBody($body);

$emitter->emit($response); // Hello World!