Naming conventions¶
Based on the extension key of an extension these naming conventions should be followed:
Attention
((The following table is unreadable and has been translated to the following normal text. The table will be dropped soon.))
General | Example | User-specific | Example | |
---|---|---|---|---|
Extension key (Lowercase "alnum" + underscores. ) |
Assigned by the TYPO3 Extension Repository. | cool_shop | Determined by yourself, but prefixed "user_" | user_my_shop |
Database tables and fields | Prefix with "tx_[ key ]_" where key is without underscores! | Prefix: tx_coolshop_ Examples: tx_coolshop_products tx_coolshop_categories |
Prefix with "[ key ]_" | Prefix: user_my_shop_ Examples: user_my_shop_products user_my_shop_categories |
Backend module (Names are always without underscores!) |
Name: The extension key name without underscores, prefixed "tx" | txcoolshop | Name: No underscores, prefixed "u" | uMyShop or umyshop or ... |
- Abbreviations
- TER = TYPO3 extension repositoryextkey = extension keymodkey = backend module key
- Public extensions
Public extensions are available from the TER or via Packagist. Private extensions are not published to the TER or Packagist.
The extkey is made up of alphanumeric characters and underscores only and should start with a letter.
Example: cool_shop
The extkey is valid if the TER accepts it. This makes sure that the name follows the rules and is unique.
Database tablenames look like
tx_
+ extkey (without underscores) +_specification
.Examples: tx_coolshop_products, tx_coolshop_categories, tx_coolshop_more_categories, tx_coolshop_domain_model_tag.
- Backend modules
The modkey is made up of alphanumeric characters only. It does not contain underscores and starts with a letter.
Example: coolshop
- Frontend PHP classes
- For frontend PHP classes, follow the same conventions as for database tables and fields.
You may also want to refer to the TYPO3 Core Coding Guidelines for more on general naming conventions in TYPO3.
Tip
If you study the naming conventions above closely you will find that they are complicated due to varying rules for underscores in key names. Sometimes the underscores are stripped off, sometimes not.
The best practice you can follow is to avoid using underscores in your extensions keys at all! That will make the rules simpler. This is highly encouraged.
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.
Further, some of the classic plugins (tt_board, tt_guest etc) use the "user_" prefix for their classes as well.
Extending "extensions classes"¶
As a standard procedure you should include the "class extension code" even in your own extensions. This is placed at the bottom of every class file:
if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/myext/pi1/class.tx_myext_pi1.php'])) {
include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/myext/pi1/class.tx_myext_pi1.php']);
}
Normally the key used as example here ("ext/myext/pi1/class.tx_myext_pi1.php")
would be the full path to the script relative to \TYPO3\CMS\Core\Core\Environment::getPublicPath()
. However because modules are required to work from both
typo3/sysext/
and typo3conf/ext/
it is a policy that any
path before "ext/" is omitted.