pepeverde/expect-ct-builder

Easily add Excepct-CT header to your project

Maintainers

👁 endelwar

Package info

github.com/pepeverde/Expect-CT-Builder

Issues

pkg:composer/pepeverde/expect-ct-builder

Statistics

Installs: 381

Dependents: 0

Suggesters: 0

Stars: 2

v1.0.1 2019-06-11 18:58 UTC

Requires

  • php: ^5.6|^7.0

Requires (Dev)

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 10da4f4d26694c6d244897853e88c58970015ad0

  • Manuel Dalla Lana <manuel.woop@pepeverde.agency>

httpsecurityheadersexpect-ct

This package is auto-updated.

Last update: 2026-06-12 09:58:24 UTC


README

👁 Build Status
👁 Scrutinizer Code Quality
👁 codecov

The Expect-CT HTTP header tells browsers to expect Certificate Transparency. For more information, see this blog post by Scott Helme and the in-progress spec.

Expect-CT Builder was inspired by ParagonIE\CSPBuilder

Usage

<?php

use \Pepeverde\ECTBuilder\ECTBuilder;

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

Inject an Expect-CT into a PSR-7 message

Instead of invoking sendECTHeader(), you can instead inject the headers into your PSR-7 message object by calling it like so:

/**
 * $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);