Documentation

Headers
in package

Headers class.

Table of Contents

$csp  : array<string|int, string>
Default CSP header values.
$instance  : self
Headers instance.
$headers  : array<string|int, string>
Default header values.
$headersToDelete  : array<string|int, string>
Headers to delete.
__construct()  : mixed
Construct, loads default headers depending on the browser and environment.
getCspHeader()  : string
Get CSP headers string.
getHeaders()  : array<string|int, string>
Get headers string.
getInstance()  : self
Get headers instance.
loadCsp()  : void
Load CSP directive.
send()  : void
Send headers.
setHeader()  : mixed
Set header.

Properties

$csp

Default CSP header values.

public array<string|int, string> $csp = ['default-src' => ''self' blob:', 'img-src' => ''self' data:', 'script-src' => ''self' 'unsafe-inline' blob:', 'form-action' => ''self'', 'frame-ancestors' => ''self'', 'frame-src' => ''self' mailto: tel:', 'style-src' => ''self' 'unsafe-inline'', 'connect-src' => ''self'']

$instance

Headers instance.

public static self $instance

.

$headers

Default header values.

protected array<string|int, string> $headers = ['access-control-allow-methods' => 'GET, POST', 'access-control-allow-origin' => '*', 'expires' => '-', 'last-modified' => '-', 'pragma' => 'no-cache', 'cache-control' => 'private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0', 'content-type' => 'text/html; charset=UTF-8', 'referrer-policy' => 'no-referrer', 'expect-ct' => 'enforce; max-age=3600', 'x-frame-options' => 'sameorigin', 'x-xss-protection' => '1; mode=block', 'x-content-type-options' => 'nosniff', 'x-robots-tag' => 'none', 'x-permitted-cross-domain-policies' => 'none']

$headersToDelete

Headers to delete.

protected array<string|int, string> $headersToDelete = ['x-powered-by', 'server']

Methods

__construct()

Construct, loads default headers depending on the browser and environment.

public __construct() : mixed
Return values
mixed

getCspHeader()

Get CSP headers string.

public getCspHeader() : string
Return values
string

getHeaders()

Get headers string.

public getHeaders() : array<string|int, string>
Return values
array<string|int, string>

getInstance()

Get headers instance.

public static getInstance() : self
Return values
self

loadCsp()

Load CSP directive.

public loadCsp() : void
Return values
void

send()

Send headers.

public send() : void
Return values
void

setHeader()

Set header.

public setHeader(string $key, string $value) : mixed
Parameters
$key : string
$value : string
Return values
mixed

Search results