Download the PHP package madj2k/t3-accelerator without Composer
On this page you can find all versions of the php package madj2k/t3-accelerator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download madj2k/t3-accelerator
More information about madj2k/t3-accelerator
Files in madj2k/t3-accelerator
Package t3-accelerator
Short Description Speed up your TYPO3 installation: add Critical CSS (Above The Fold) inline, minify the HTML of your website, use subdomains as CDN to reduce page load, manage proxy-caching (e.g with Varnish) via page-properties.
License GPL-2.0+
Homepage https://www.steffenkroggel.de
Informations about the package t3-accelerator
Accelerator
Features
Speed up your TYPO3 installation:
- add Critical CSS (Above The Fold) inline *
- minify the HTML of your website
- use subdomains as CDN for your static contents (images, files, ...) to speed up the loading time of your website
- manage proxy-caching (e.g with Varnish) via page-properties
- can be used with Hetzner Varnish for Managed Servers
- reduce database size when storing JSON-arrays with persisted objects to the database.
1. HTML Minifier
1.1 Description
This function removes unnecessary breaks and spaces from the HTML code. This significantly reduces the size of the HTML code.
1.2 Settings
IMPORTANT: Since TYPO3 v10 the configuration is no longer possible via TypoScript because it is now implemented as Middleware. It is now possible to configure it via your site-configuration (YAML) instead.
- enable activates the HTML Minify
- excludePids excludes the PIDs defined in this comma-separated list
- includePageTypes includes the pageTypes defined in this comma-separated list
Please note: The variants only work with the enable-attribute
For a default-setup it is sufficient to set
2. Pseudo-CDN
2.1 Description
With the CDN functionality it is possible to reduce the loading time of the website considerably by loading static content from subdomains of the respective website. This is not a real CDN, but a "Pseudo-CDN", since no external servers are used. It uses sub-domains of the given domain to deliver static contents and therefore it needs
- a corresponding DNS-configuration
- a wildcard TLS-certificate to work properly. How this is done is not part of this documentation - but you can ask me any time :-)
Example without Pseudo-CDN
Example with active Pseudo-CDN
2.2 Settings
IMPORTANT: Since TYPO3 v10 the configuration is no longer possible via TypoScript because it is now implemented as Middleware. It is now possible to configure the PseudoCdn via your site-configuration (YAML) instead. Important: the DNS has to be configured accordingly and a Wildcard-TLS-certificate has to be installed before activating this functionality
- enable activates the Pseudo-CDN
- maxConnectionsPerDomain defines how many resources are loaded from a subdomain.
- maxSubdomains defines how many sudomains there should be. If the value is set to 10 the subdomains static1.example.com to static10.example.com are used.
- search allows to override the regular expression for searching/replacing paths to static content
- ignoreIfContains allows to specify exclusion criteria for the pseudoCDN. Especially JS files should be excluded here (cross-domain issues)
Please note: The variants only work with the enable-attribute
For a default-setup it is sufficient to set
3. Inline Critical CSS (Above-The-Fold)
3.1 Description
To increase the loading speed of your website, so-called critical CSS (above the fold) can be stored in a separate file. This critical CSS is then written inline into the HTML of the website, while the rest of the CSS (which is included via page.includeCSS) is added in such a way that it does not block the rendering of the page (as is otherwise usual).
The critical CSS can be specified per
- url-path (filesForPath): You can define regular expressions defining the url-path for your critical CSS
- page-uid (filesForPage): You can define lists of pids for your critical CSS
- frontend-layout (filesForLayout): We use the fields 'backend_layout' and 'backend_layout_next_level' from the pages-table here.
Important:
- The definintion-sets take action in the above order. So, if you define a rule by url-path it takes precedence over a rule by page-uid or frontend-layout.
- The rules for filesForPath and filesForPage are processed in the order of their definition. If a rule in these sets matches, the rules later on in this set are ignored.
If no critical CSS is specified, the CSS files are included normally.
3.2 Settings
IMPORTANT: Since TYPO3 v10 the configuration is no longer possible via TypoScript because it is now implemented as Middleware. It is now possible to configure it via your site-configuration (YAML) instead.
- enable activates the critical CSS inclusion
- layoutField sets the field in page-properties which is used to determine the defined layout of the current page for including the correct css-files. The default value is "backend_layout". If you don't use another field you can omit this setting. If you use your own property, make sure it is added as rootline-field.
- layoutFieldNextLevel sets the field in page-properties which is used to determine the defined layout of the subpages for including the correct css-files. The default value is "backend_layout_next_level". If you don't use another field you can omit this setting. If you use your own property, make sure it is added as rootline-field.
- filesForLayout contains the keys and CSS-files that are to be included if the layout of the page matches the defined key. The keys are the values set in the defined layoutField- / layoutFieldNextLevel-property of the page ("pagets"-prefix is removed). If there is no match, no file will be included. The example above would include the files criticalOne.css and criticalTwo.css on a page on which the backendLayout-property is set to "pagetshome".
- filesToRemoveWhenActive defines files that will be removed from page.includeCss if criticalCSS is activated and working on the current page
Please note: The variants only work with the enable-attribute.
If the pageType 1715339215 or the GET-Param no_critical_css=1 is used critical css is disabled. This is helpful for rendering the critical css e.g. via NPM critical.
4. Proxy Caching e.g. with Varnish
IMPORTANT: If you work with proxyCaching you definitivly need an extension that handles the purging of its cache if changes happen to your content. I strongly recommend sopsone-ch/varnish
4.1 Description
This extension allows an extended setup with a proxy-cache like e.g. Varnish. By default pages are excluded from proxy-caching if a frontend cookie is set. This is to prevent personal data from being cached and thus becoming visible to strangers.
Conversely, however, this means that proxy-caching is completely disabled for logged-in front-end users, so that they can no longer benefit from the performance improvement provided by a proxy-cache for the entire page. To avoid this, this extension provides a field "Allow Proxy-Caching" in the page properties in the backend. This has the following options:
- Inherit: Inherits the settings from the page rootline
- Deactivate: Completely deactivates the ProxyCache for this page (and its subpages if applicable). This setting is useful e.g. for time-controlled plugins on the page
- Activate: Enables the ProxyCache explicitly even if a frontend cookie is set. This allows pages to be served from the Varnish cache even if a user is logged in. This should only be activated for pages that do not contain personal data.
The values of the fields are inherited down the page-tree and result in a HTTP-Header which is added:
4.2 xkeys sopsone-ch/varnish
The madj2k/t3-accelerator normally add a second HTTP-Header which contains a unique tag (HMAC-Key) for the whole website and another one for the current page. They can be used for clearing the proxy-cache selectively based on tags.
However, newer versions of sopsone-ch/varnish already implement xkey, so that if you activate it in sopsone-ch/varnish, the madj2k/t3-accelerator will not send xkeys any more.
4.3 Hetzner Managed Server Varnish
Hetzner recently implemented an own Varnish-Setup for their Managed Servers.
They already use xkey with PURGE, but the header for the purge with xkey has to be x-xkey-purge
in order to selectively purge the cache.
However sopsone-ch/varnish uses xkey-purge
as header. The madj2k/t3-accelerator fixes this
if you set proxyCachingMode
to hetzner
in the extension-settings.
4.4 Example-Configuration for usage with Varnish Proxy-Cache
The proxy-caching setup only works if the appropriate settings are made in the proxy cache configuration. Since proxy-cache configurations are very individual, only the relevant lines that control the behavior of the proxy-cache according to the above specifications are listed here. The following configuration example assumes that is used together with .
All versions of t3-accelerator with dependencies
ext-json Version *
typo3/cms-core Version ~10.4.0 || ~11.5.0 || ~12.4.0 || ~13.4.0