Feature #78665
closedCustom entry point without request handling
0%
Description
This one is a bit technical, but essentially, the idea is to provide an entry point (php file) which can be included from third-party scripts which reside in vendor/bin in order to fully bootstrap a TYPO3 environment without doing any request processing.
The result is that including or requiring this entry point in a vendor/bin-installed script gives a fully bootstrapped TYPO3 environment with zero output and no actions performed on inputs. What this means is that all TYPO3 configuration, constants, environment and other information such as the ability to use ExtensionManagementUtility, CacheManager, database connection using TYPO3 implementation and much, much more.
The actual use case for this is as follows:
./vendor/bin/fluid --renderingContext "TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContext" \ --templateRootPaths typo3/sysext/fluid_styled_content/Resources/Private/Templates/ \ --layoutRootPaths typo3/sysext/fluid_styled_content/Resources/Private/Layouts/ \ --partialRootPaths typo3/sysext/fluid_styled_content/Resources/Private/Partials/ \ --bootstrap typo3/sysext/backend/Resources/Private/Php/custom.php \ --warmup
To briefly explain this code: when both TYPO3 and Fluid are installed as composer dependencies, Fluid's cache warmup feature can be fully utilised even though templates may depend on any number of TYPO3 context and settings. What the command does is create an instance of the desired RenderingContext (and with that, the cache that contains the compiled templates). Before it attempts to create any instances it will include the "bootstrap" file passed to the argument - and this bootstrap contains a custom application bootstrapping which avoids all request handling. Phew.
An example output of the above command after implementing a CustomApplication and custom.php entry point:
Template cache warmup results /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Bullets.html Compiled? YES Has Layout? YES Compiled as: Default_action_Bullets_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Default.html Compiled? YES Has Layout? NO Compiled as: Default_action_Default_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Div.html Compiled? YES Has Layout? YES Compiled as: Default_action_Div_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Header.html Compiled? YES Has Layout? YES Compiled as: Default_action_Header_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/HeaderOnly.html Compiled? YES Has Layout? NO Compiled as: Default_action_HeaderOnly_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Html.html Compiled? YES Has Layout? YES Compiled as: Default_action_Html_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/List.html Compiled? YES Has Layout? YES Compiled as: Default_action_List_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Menu.html Compiled? YES Has Layout? YES Compiled as: Default_action_Menu_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Shortcut.html Compiled? YES Has Layout? YES Compiled as: Default_action_Shortcut_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Table.html Compiled? YES Has Layout? YES Compiled as: Default_action_Table_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Textmedia.html Compiled? YES Has Layout? NO Compiled as: Default_action_Textmedia_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Uploads.html Compiled? YES Has Layout? YES Compiled as: Default_action_Uploads_3eb416223e9e69e6bb8ee19793911ad1ad2027d8 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Partials/Footer.html Compiled? YES Has Layout? NO Compiled as: partial_Footer_b2f76314f282448bb66fc604bb8f8a452770a0f6 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Partials/Header.html Compiled? YES Has Layout? NO Compiled as: partial_Header_52ce7bcf5b3a09af444e6e09839b85f205cb54e7 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Partials/MediaGallery.html Compiled? NO Has Layout? NO Compiled as: partial_MediaGallery_04a215c8ce3cf375fc4b5c62677a916337227690 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Layouts/ContentFooter.html Compiled? YES Has Layout? NO Compiled as: layout_ContentFooter_html_8c10fcca645b093474ea01970e6021ca72cad302 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Layouts/HeaderContentFooter.html Compiled? YES Has Layout? NO Compiled as: layout_HeaderContentFooter_html_edab70f1f436cd3e36f02a82ab5525259546d7d2 /Users/claus/Sites/trunk.namelesscoder.net/typo3/sysext/fluid_styled_content/Resources/Private/Layouts/HeaderFooter.html Compiled? YES Has Layout? NO Compiled as: layout_HeaderFooter_html_43f125fff304805a22647b1d1be8ffb6c2493056
As you can see from this output, with a VERY simple bootstrapping Fluid (and a lot of other third-party applications like typo3_console!) some quite significant integrations become possible, between an installed TYPO3 site and utilities installed as composer dependencies.