Attention
TYPO3 v11 has reached end-of-life as of October 31th 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.
Naming conventions
The first thing you should decide on is the extension key for your extension and the vendor name. A significant part of the names below are based on the extension key.
Tip
Some of the names, such as extension key or vendor name, will be spelled differently, depending on where they are used, for example:
- underscores (
_
) in the extension key should be replaced by dashes (-
), when used in the package name in the filecomposer.
(e.g.json cool_
becomesshop <vendor>/
)cool- shop - underscores in the extension key should be removed by converting the extension key
to UpperCamelCase in namespaces (e.g.
cool_
becomesshop \My
)Vendor\ Cool Shop
Abbreviations & Glossary
- UpperCamelCase
- UpperCamelCase begins
with a capital letter and begins all following subparts of a word with a
capital letter. The rest of each word is in lowercase with no spaces,
e.g.
Cool
.Shop - lowerCamelCase
- lowerCamelCase is the same as UpperCamelCase, but begins with a lowercase letter.
- TER
- The "TYPO3 Extension Repository": A catalogue of extensions where you can find information about extensions and where you can search and filter by TYPO3 version etc. Once registered on https://my.typo3.org, you can login and register an extension key for your extension in https://extensions.typo3.org My Extensions.
- extkey
- The extension key as is (e.g. 'my_extension').
- extkeyprefix
- The extension key with stripped away underscores (e.g. extkey='my_extension' becomes extkeyprefix='myextension').
- ExtensionName
-
The term ExtensionName means the extension key in UpperCamelCase.
Example: for an extkey
bootstrap_
the ExtensionName would bepackage Bootstrap
.Package The ExtensionName is used as first parameter in the Extbase methods
Extension
orUtility:: configure Plugin () Extension
.Utility:: register Module () - modkey
- The backend module key.
- Public extensions
- Public extensions are publicly available. They are usually registered in TER and available via Packagist.
- Private extensions
- These are not published to the TER or Packagist.
Some of these "Conventions" are actually mandatory, meaning you will most likely run into problems if you do not adhere to them.
We very strongly recommend to always use these naming conventions. Hard requirements are emphasized by using the words MUST, etc. as specified in RFC 2119. SHOULD or MAY indicate a soft requirement: strongly recommended but will usually work, even if you do not follow the conventions.
Tip
If you study the naming conventions closely you will find that they are complicated due to varying rules derived from the extkey, if the extkey contains underscores. Sometimes the underscores are stripped off, sometimes not, sometimes a name in UpperCamelCase is created.
The best practice you can follow is to avoid using underscores in your extensions keys altogether. That will make the rules simpler and is highly recommended.
Extension key (extkey)
The extension key (extkey) is used as is in:
- directory name of extension in
typo3conf/
(orext typo3/
for system extensions)sysext
Derived names are:
- package name in
composer.
json <vendor-
. Underscores (name>/<package- name> _
) should be replaced by dashes (-
) - namespaces: Underscores in the extension key are removed by converting the extension key
to UpperCamelCase in namespaces (e.g.
cool_
becomesshop My
).Vendor\ Cool Shop
Important
If you plan to publish your extension, the extension key must be unique worldwide. This will be checked and enforced once you register the extension key on extensions.typo3.org.
The extkey is valid if the TER accepts it. This also makes sure that the name follows the rules and is unique.
Do this early! An already reserved key can usually only be transferred if the original author agrees to this.
- The extkey MUST be unique within your installation.
- The extkey MUST be made up of lowercase alphanumeric characters and underscores only and MUST start with a letter.
- More, see extension key
- Examples for extkeys:
-
cool_
shop blog
Examples for names that are derived from the extkey:
Here, the extkey is my_
:
- namespace:
My
Vendor\ My Extension\... - package name in
composer.
:json vendor-name/my-extension
(the underscore is replaced by a dash)
Vendor name
The vendor name is used in:
- namespaces
- package name in
composer.
, e.g.json myvendor/cool-shop
(all lowercase)
Important
The vendor name MUST be unique (if you publish your extensions on packagist).
Register your vendor name early on Packagist!
Use common PHP naming conventions for vendor names in namespaces and check PSR-0. There are currently no strict rules, but commonly used vendor names begin with a capital letter, followed by all lowercase.
The vendor name (as well as the extkey) is spelled with all lowercase when
used in the package name in the file composer.
For the following examples, we assume:
- the vendor name is
My
Company - the extkey is
my_
example
- Examples:
-
- Namespace:
My
Company\ My Example\... - package name (in
composer.
):json my-
company/ my- example
- Namespace:
See also
Database table name
These rules apply to public extensions, but should be followed nevertheless.
Database table names should follow this pattern:
tx_<extkeyprefix>_<table_name>
<extkeyprefix>
is the extension key without underscores, sofoo_
becomesbar foobar
<table_
should clearly describe the purpose of the tablename>
Examples for an extension named cool_
:
tx_
coolshop_ product tx_
coolshop_ category
Extbase domain model tables
Extbase domain model tables should follow this pattern:
tx_<extkeyprefix>_domain_model_<model-name>
<extkeyprefix>
is the extension key without underscores, sofoo_
becomesbar foobar
<model-
should match the domain model namename>
Examples for Extbase domain models and table names of an extension named cool_
:
Domain model | Table name |
---|---|
\Vendor\
\Vendor\
\Vendor\
\Vendor\ | tx_
tx_
tx_
tx_ |
Tip
You may notice, that the names above use the singular form, e.g. post
and
not posts
. This is recommended, but not always followed. If you do not follow this pattern,
you may need manual mapping.
MM-tables for multiple-multiple relations between tables
MM tables (for multiple-multiple relations between tables) follow these rules.
Extbase:
# rule for Extbase
tx_<extkeyprefix>_domain_model_<model-name-1>_<model-name-2>_mm
# example: EXT:blog with relation between post and comment
tx_blogexample_domain_model_post_comment_mm
Non-Extbase tables usually use a similar rule, without the "domain_model" part:
# recommendation for non-Extbase third party extensions
tx_<extkeyprefix>_<model-1>_<model-2>_mm
# Example
tx_myextension_address_category_mm
# example for TYPO3 core:
sys_category_record_mm
Database column name
When extending a common table like tt_
, column names SHOULD
follow this pattern:
tx_<extkeyprefix>_<column-name>
<extkeyprefix>
is the extension key without underscores, sofoo_
becomesbar foobar
<column-
should clearly describe the purpose of the columnname>
Backend module key (modkey)
The main module key SHOULD contain only lowercase characters. Do not use an underscore or dash.
The submodule key MUST be made up of alphanumeric characters only. It MAY contain underscores and MUST start with a letter.
- Example:
-
Coolshop
Example usage:
// Module System > Backend Users
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
// ExtensionName
'CoolShop',
// Main module key (use existing main module 'web' here)
'web',
// Submodule key
'ProductManagement'
// ...
);
Backend module signature
The backend module signature is a derived identifier which is constructed by TYPO3 when the module is registered.
The signature is usually constructed by using the main module key and submodule key, separated by an underscore. Conversions, such as underscore to UpperCamelCase or conversions to lowercase may be applied in this process.
Examples (from TYPO3 core extennsions):
- web_info
- web_FormFormbuilder
- site_redirects
Tip
Registered modules are added to $GLOBALS
.
You can look at existing module signatures in System > Configuration > Backend Modules.
Plugin key
The plugin key is registered in:
- second parameter in
register
(Extbase)Plugin () - or in
add
(for non Extbase plugins)Plugin ()
The same plugin key is then used in the following:
- second parameter in
configure
(Extbase): MUST match registered plugin key exactlyPlugin () - the plugin signature
- in TypoScript, e.g.
plugin.
tx_ myexample_ myplugin - in TCA
- etc.
The plugin key can be freely chosen by the extension author, but you SHOULD follow these conventions:
- do not use underscore
- use UpperCamelCase, e.g. InventoryList
- use alphanumeric characters
For the plugin key, Pi1
, Pi2
etc. are often used, but it can be named differently.
The plugin key used in register
and configure
MUST match.
Plugin signature
The plugin signature is automatically created by TYPO3 from the extension key and plugin key.
For this, all underscores in extension key are omitted and all characters lowercased.
The extkey and plugin key are separated by an underscore (_
):
extkey_
The plugin signature is used in:
- the database field
tt_
content. list_ type - when defining a FlexForm to be used for the plugin in
add
Pi Flex Form Value ()
- Examples:
-
Assume the following:
- extkey is
my_
extension - plugin key is
Inventory
List
The derived name for the "plugin signature" is:
myextension_
This is used in tt_content.list_type and as first parameter ofinventorylist add
.Pi Flex Form Value ()
- extkey is
Class name
Class names SHOULD be in UpperCamelCase.
- Examples:
-
Code
Completion Controller Ajax
Controller
See also
This follows PSR-1 conventions.
Upgrade wizard identifier
You SHOULD use the following naming convention for the identifier:
ext
This is not enforced.
Please see Wizard identifier in the Upgrade Wizard chapter for further explanations.
Note on "old" extensions
Some the "classic" extensions from before the extension structure came about do not comply with these naming conventions. That is an exception made for backwards compatibility. The assignment of new keys from the TYPO3 Extension Repository will make sure that any of these old names are not accidentally reassigned to new extensions.
Furthermore, some of the classic plugins (tt_board, tt_guest etc) use the "user_" prefix for their classes as well.