Download the PHP package fyre/csp without Composer
On this page you can find all versions of the php package fyre/csp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package csp
FyreCSP
FyreCSP is a free, open-source content security policy library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Policies
- Middleware
Installation
Using Composer
In PHP:
Basic Usage
$config
is a Config.
Default configuration options will be resolved from the "Csp" key in the Config.
$options
is an array containing configuration options.default
is an array containing the policy directives, and will default to[]
.report
is an array containing the report-only directives, and will default to null.reportTo
is an array containing the Report-To header value, and will default to [].
Autoloading
It is recommended to bind the ContentSecurityPolicy to the Container as a singleton.
Any dependencies will be injected automatically when loading from the Container.
Methods
Add Headers
Add CSP headers to a ClientResponse.
$response
is a ClientResponse.
Clear
Clear all policies.
Create Policy
Create a Policy.
$key
is a string representing the policy key, and should be one of eitherContentSecurityPolicy::DEFAULT
orContentSecurityPolicy::REPORT
.$directives
is an array containing the directives to add, and will default to [].
Get Policy
Get a Policy.
$key
is a string representing the policy key, and should be one of eitherContentSecurityPolicy::DEFAULT
orContentSecurityPolicy::REPORT
.
Get Policies
Get all policies.
Get Report To
Get the Report-To values.
Has Policy
Determine whether a policy exists.
$key
is a string representing the policy key, and should be one of eitherContentSecurityPolicy::DEFAULT
orContentSecurityPolicy::REPORT
.
Set Policy
Set a policy.
$key
is a string representing the policy key, and should be one of eitherContentSecurityPolicy::DEFAULT
orContentSecurityPolicy::REPORT
.$policy
is a Policy.
Set Report To
Set the Report-To values.
$reportTo
is an array containing the Report-To values.
Policies
Add Directive
Add options to a directive.
$directive
is a string representing the directive.$value
is a string, or an array of strings containing the values to add. For directives that don't require values, you can set this to true or false indicating whether to include the directive.
Get Directive
Get the options for a directive.
$directive
is a string representing the directive.
Get Header
Get the header string.
Has Directive
Determine whether a directive exists.
$directive
is a string representing the directive.
Remove Directive
Remove a directive.
$directive
is a string representing the directive.
Middleware
$csp
is a ContentSecurityPolicy.
Any dependencies will be injected automatically when loading from the Container.
Handle
Handle a ServerRequest.
$request
is a ServerRequest.$next
is a Closure.
This method will return a ClientResponse.
All versions of csp with dependencies
fyre/container Version ^1.0
fyre/middleware Version ^6.0
fyre/server Version ^4.0