PHP code example of pepeverde / expect-ct-builder

1. Go to this page and download the library: Download pepeverde/expect-ct-builder 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/ */

    

pepeverde / expect-ct-builder example snippets




use \Pepeverde\ECTBuilder\ECTBuilder;

$expectCT = new ECTBuilder([
    'enforce' => true,
    'maxAge' => 30,
    'reportUri' => 'https://example.org/report'
]);
$expectCT->sendECTHeader();

/**
 * $yourMessageHere is an instance of an object that implements 
 * \Psr\Http\Message\MessageInterface
 *
 * Typically, this will be a Response object that implements 
 * \Psr\Http\Message\ResponseInterface
 *
 * @ref https://github.com/guzzle/psr7/blob/master/src/Response.php
 */
$expectCT->injectECTHeader($yourMessageHere);