Download the PHP package vaersaagod/toolmate without Composer
On this page you can find all versions of the php package vaersaagod/toolmate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package toolmate
ToolMate plugin for Craft CMS
Is that a tool in your pocket, or are you just happy to see me, mate!
Requirements
This plugin requires Craft CMS 3.1.0 or later.
Installation
To install the plugin, either install it from the plugin store, or follow these instructions:
- Install with composer via
composer require vaersaagod/toolmate
from your project directory. - Install the plugin in the Craft Control Panel under Settings → Plugins, or from the command line via
./craft install/plugin toolmate
.
Configuring
ToolMate can be configured by creating a file named toolmate.php
in your Craft config folder,
and overriding settings as needed.
publicRoot [string]
Default: @webroot
Sets the public webroot that is used by inline and stamp on servers
where $_SERVER['DOCUMENT_ROOT']
and @webroot
is incorrect.
enableMinify [bool]
Default: true
Enables/disables all minifying.
embedCacheDuration [int|string|bool|null]
Default: null
The number of seconds to cache responses from craft.toolmate.getVideoEmbed()
.
If set to null
, the core cacheDuration
setting is used.
If set to false
responses are not cached.
If set to 0
, cached responses will be stored indefinitely.
See craft\helpers\ConfigHelper::durationInSeconds()
for a list of supported value types.
embedCacheDurationOnError [int|string|bool|null]
Default: 300
(5 minutes)
The number of seconds to cache responses from craft.toolmate.getVideoEmbed()
when there is an error (i.e. a valid embed code could not be returned).
If set to null
, the default value (300
, 5 minutes) is used.
If set to false
, error responses are not cached.
If set to 0
, error response caches will be stored indefinitely.
See craft\helpers\ConfigHelper::durationInSeconds()
for a list of supported value types.
csp [array|null]
Default null
Configure the Content-Security-Policy header set by Toolmate. Some useful tips:
- Avoid using
unsafe-inline
andunsafe-eval
policies, especially for thescript-src
directive. CSP nonces should ideally be used for inline script or style tags, see thecspNonce()
Twig function. - Nonces and
unsafe-inline
cannot be combined. Toolmate works around this to avoid CSP errors, but TLDR; is that you don't need to set nonces if you're also usingunsafe-inline
. - CSP nonces generated by
cspNonce()
are safe to put inside{% cache %}
tags - To enable data-URLs, add a
data:
policy to the relevant directives - For CP requests, Toolmate will always add the necessary
unsafe-inline
andunsafe-eval
policies, because the CP isn't possible to use without.
csp[enabled] [bool]
Default false
If set to false
, the CSP header will not be sent for any requests.
csp[enabledForCp] [bool]
Default false
If set to false
, the CSP header will only be sent for site requests.
csp[reportOnly] [bool]
Default false
If set to true
, the CSP header will be sent, but not enforced (i.e. dry-run mode). Useful for testing policies.
csp[directives] [array]
See https://content-security-policy.com/, and the example config below.
Example CSP configuration:
Template variables
craft.toolmate.inline(filename [, remote=false])
craft.toolmate.stamp(filename [, mode = 'file', type = 'ts'])
craft.toolmate.setCookie(params [, secure = false])
craft.toolmate.getCookie(name [, secure = false])
craft.toolmate.getVideoEmbed(url [, params = []])
Twig tags
minify
Twig functions
inline(filename [, remote=false])
See craft.toolmate.inline
.
stamp(filename [, mode = 'file', type = 'ts'])
See craft.toolmate.stamp
.
setCookie(params [, secure = false])
See craft.toolmate.setCookie
.
getCookie(name [, secure = false])
See craft.toolmate.getCookie
.
getVideoEmbed(url [, params = []])
See craft.toolmate.getCookie
.
cspNonce(directive, [, asAttribute = false, hash = true])
Output a CSP nonce. Example:
Price, license and support
The plugin is released under the MIT license. It's made for Værsågod and friends, and no support is given. Submitted issues are resolved if it scratches an itch.
Changelog
See CHANGELOG.MD.
Credits
Brought to you by Værsågod
Icon designed by Freepik from Flaticon.
All versions of toolmate with dependencies
craftcms/cms Version ^3.1.0|^4.0.0-beta.1|^5.0.0-beta.1
matthiasmullie/minify Version ^1.3.0
voku/html-min Version ^4.4.0