Minimal site package
A site package is a custom TYPO3 extension which contains configuration, templates, assets, etc that are used for the site it belongs to.
So first we create a minimal extension.
Create a minimal TYPO3 extension using b13/make
b13/make is a convenient TYPO3 extension which you can use during development to create a new TYPO3 extension quickly or add functionality to an existing one.
Use Composer to install it for development only:
ddev composer req b13/make --dev
Execute the command ddev typo3 make:
and answer the prompt
ddev typo3 make:extension
Enter the composer package name (e.g. "vendor/awesome"):
> t3docs/site-package
Enter the extension key [site_package]:
>
Enter the PSR-4 namespace [T3docs/SitePackage]:
>
Choose supported TYPO3 versions (comma separate for multiple) [TYPO3 v12 LTS]:
[10] TYPO3 v10 LTS
[11] TYPO3 v11 LTS
[12] TYPO3 v12 LTS
[13] TYPO3 v13
> 12
Enter a description of the extension:
> My site package
Where should the extension be created? [src/extensions/]:
> packages
May we add a basic service configuration for you? (yes/no) [yes]:
> no
May we create a ext_emconf.php for you? (yes/no) [no]:
>
[OK] Successfully created the extension my_site_package (myvendor/my-site-package).
This script creates a new folder called packages
with a subfolder,
my-
. It mainly contains only a file called composer.
.
You could of course also create this file manually. Step
Extension Configuration will explain the content of the composer.
.
For the time being just remember the Composer name you have chosen
(t3docs/
) and the extension name (site_
).
In order to see a change in the TYPO3 backend or frontend your site package needs to be installed.
After you have created your site package extension you can uninstall b13/make :
ddev composer remove b13/make --dev
The TypoScript-only version
Create a file called setup.
containing basic TypoScript configuration
in the folder Configuration/
:
# Create the frontend output of the page
page = PAGE
page {
# Show a text with value "Hello TypoScript World!"
10 = TEXT
10.value = Hello TypoScript World!
}
Clear all caches and preview the web page.
You can learn more about the TypoScript syntax used here in chapter A minimal page created by pure TypoScript of the "Getting Started Tutorial".
The TYPO3 Fluid version
Replace file setup.
of example
minimal-
with the following lines:
page = PAGE
page {
10 = PAGEVIEW
10 {
paths {
100 = EXT:site_package/Resources/Private/Templates/
}
}
}
If you preview your page now you would get an error output like:
Oops, an error occurred! Request: bddd8a816bda3
This is because the template has not been found.
By searching for the hash bddd8a816bda3
in the log file you will find such an entry:
Mon, 07 Oct 2024 04:09:44 +0000 [ALERT] request="bddd8a816bda3"
component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler":
Oops, an error occurred! Request: bddd8a816bda3- InvalidTemplateResourceException:
Tried resolving a template file for controller action "Default->Pages/Default"
in format ".html", but none of the paths contained the expected template file
(Default/Pages/Default.html).
The following paths were checked: /var/www/html/vendor/t3docs/site-package/Resources/Private/Templates/
This error message also tells you the path where TYPO3 expects to find the file. If no path is listed here, the path defined in line 6 of the TypoScript above is incorrect, for example if you mistyped the extension name or part of the path.
Create a file named Default.
in folder
packages/
.
Hello Fluid World!
Clear all caches and preview the web page.
Learn more about using Fluid Templates in chapter Fluid Templates.