Attention
TYPO3 v11 has reached end-of-life as of October 31st 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
Extension Configuration
Composer configuration composer.json
If you are planning to work with a Composer-based installation (as we would
advise) the extension needs to contain its own composer.
.
{
"name": "t3docs/site-package",
"type": "typo3-cms-extension",
"description": "Example site package from the site package tutorial",
"authors": [
{
"name": "TYPO3 CMS Documentation Team",
"role": "Developer",
"homepage": "https://typo3.org/community/teams/documentation"
},
{
"name": "The TYPO3 Community",
"role": "Contributor",
"homepage": "https://typo3.org/community/"
}
],
"require": {
"typo3/cms-core": "^11.5",
"typo3/cms-fluid-styled-content": "^11.5"
},
"homepage": "https://github.com/TYPO3-Documentation/TYPO3CMS-Tutorial-SitePackage-Code",
"license": "MIT",
"keywords": [
"typo3",
"site package",
"documentation"
],
"support": {
"issues": "https://github.com/TYPO3-Documentation/TYPO3CMS-Tutorial-SitePackage-Code/issues"
},
"autoload": {
"psr-4": {
"T3docs\\SitePackage\\": "Classes/"
}
},
"extra": {
"typo3/cms": {
"extension-key": "site_package"
}
}
}
For historic reasons TYPO3 extension names have to be written in lower case
separated by underscores. We suggest to use the extension key for the directory
of the extension as well to minimize confusion. So the extension in the path
site_
has to have the
same "extension-key" to be defined in the "extra" section of the composer.json.
The Composer name defined as "name" however has to consist of a vendor name followed by a forward slash and the lowercase extension name with minus scores.
Hint
If composer does not find your site-package extension check if you are using the correct separation chars in the correct places.
Extension declaration file ext_emconf.php
Since version 11 this file is only mandatory if you are not using Composer. If you are using Composer you can omit this file as it is ignored by TYPO3 anyway.
If you are using a TYPO3 version below 11 or need to refrain from using
Composer for some reason create a file called ext_
in
the root level of the extension. The content should look as follows:
<?php
$EM_CONF[$_EXTKEY] = [
'title' => 'TYPO3 Site Package',
'description' => 'TYPO3 Site Package',
'category' => 'templates',
'author' => 'TYPO3 Documentation Team',
'author_email' => 'documentation@typo3.org',
'author_company' => 'Example Company',
'version' => '1.0.0',
'state' => 'stable',
'constraints' => [
'depends' => [
'typo3' => '11.4.0-11.5.99',
'fluid_styled_content' => '11.4.0-11.5.99'
],
'conflicts' => [
],
],
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 1
];
The values can and should be customized of course. A more meaningful and longer description is recommended.
A detailed description of all configuration options can be found in TYPO3 Explained: Declaration file.
Extension icon
Every extension can feature an icon using an SVG, PNG or GIF file.
The image should be stored in Resources/
.
It is recommended that you use an SVG file called Extension.
.
Make TypoScript available
In order to automatically load the TypoScript files we have created in the
previous step, a new PHP file sys_
needs to be created and
stored in directory Configuration/
. The content of this file
should look like the following code:
<?php
defined('TYPO3') || die();
call_user_func(function () {
/**
* Extension key
*/
$extensionKey = 'site_package';
/**
* Add default TypoScript (constants and setup)
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$extensionKey,
'Configuration/TypoScript',
'Site Package'
);
});
Directory and file structure
Let's review the directory and file structure of the sitepackage extension as it stands now.
-
-
-
-
-
sys_template.php
-
-
-
-
constants.typoscript
-
setup.typoscript
-
-
-
-
-
-
-
Default.html
-
-
-
-
-
Jumbotron.html
-
-
-
-
-
Default.html
-
-
-
-
-
-
website.css
-
-
-
Extension.svg
-
-
-
logo.png
-
-
-
website.js
-
-
-
-
composer.json
-
ext_emconf.php
-
At this point we can install the sitepackage extension in a TYPO3 instance, which we will do in the next step.