Download the PHP package fyre/csrf without Composer
On this page you can find all versions of the php package fyre/csrf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package csrf
FyreCSRF
FyreCSRF is a free, open-source CSRF protection library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Middleware
Installation
Using Composer
In PHP:
Basic Usage
Default configuration options will be resolved from the "Csrf" key in the Config.
$options
is an array containing the configuration options.cookie
is an array containing CSRF cookie options.name
is a string representing the cookie name, and will default to "CsrfToken".expires
is a number representing the cookie lifetime, and will default to 0.domain
is a string representing the cookie domain, and will default to "".path
is a string representing the cookie path, and will default to "/".secure
is a boolean indicating whether to set a secure cookie, and will default to true.httpOnly
is a boolean indicating whether to the cookie should be HTTP only, and will default to false.sameSite
is a string representing the cookie same site, and will default to "Lax".
salt
is a string representing the CSRF session key and will default to "_csrfToken".field
is a string representing the CSRF token field name, and will default to "csrf_token".header
is a string representing the CSRF token header name, and will default to "Csrf-Token".skipCheck
is a Closure that accepts a ServerRequest as the first argument.
Autoloading
It is recommended to bind the CsrfProtection to the Container as a singleton.
Any dependencies will be injected automatically when loading from the Container.
Methods
Before Response
Update the ClientResponse before sending to client.
Check Token
Check CSRF token.
$request
is the ServerRequest.
Get Cookie Token
Get the CSRF cookie token.
Get Field
Get the CSRF token field name.
Get Form Token
Get the CSRF form token.
Get Header
Get the CSRF token header name.
Middleware
$csrfProtection
is a CsrfProtection.
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 csrf with dependencies
fyre/container Version ^1.0
fyre/middleware Version ^6.0
fyre/server Version ^4.0