Extension directory structure

An extension directory can contain the following files and directories, of which many are optional. Note that this list is incomplete. A full list is available in Files and locations.

Name

ext_emconf.php

Description

This is the only mandatory file in the extension. It describes the extension for the rest of TYPO3.

Name

ext_icon.png, ext_icon.svg or ext_icon.gif

Description

This is the icon of the extension. The filename may not be changed. Preferred is using an SVG file.

Name

ext_localconf.php

Description

This file contains hook definitions and plugin configuration. It must not contain a PHP encoding declaration. The filename may not be changed.

Name

ext_tables.php

Description

This file contains declarations of modules and backend styles. It must not contain a PHP encoding declaration. For more information about table declarations and definitions see the “TYPO3 Core API” document. The filename may not be changed.

Name

ext_tables.sql

Description

This file contains SQL definitions for extension tables. The filename may not be changed.

The file may contain either a full table definition or a partial table. The full table definition declares tables of the extension. It looks like a normal SQL CREATE TABLE statement.

The partial table definition contains a list of the fields that will be added to an existing table. Here is an example:

CREATE TABLE pages (
       tx_myext_field int(11) DEFAULT '0' NOT NULL,
);

Notice the comma after the field. In the full table definition it will be an error, but in the partial table definition it is required. TYPO3 will merge this table definition to the existing table definition when comparing expected and actual table definitions. Partial definitions can also contain indexes and other directives. They can also change existing table fields though that is not recommended, because it may create problems with the TYPO3 core and/or other extensions.

TYPO3 parses ext_tables.sql files. TYPO3 expects that all table definitions in this file look like the ones produced by the mysqldump utility. Incorrect definitions may not be recognized by the TYPO3 SQL parser or may lead to MySQL errors, when TYPO3 tries to apply them.

Name

Classes/

Description

Directory for the PHP files of the extension, possibly in further subfolders like for example Controller/, Domain/, Plugin, Service/ or View/.

Name

Configuration/

Description

Directory for configuration files, in subfolders like TCA/ or TSconfig/. E.g. the subfolder TCA/ contains files named like tablename.php, which return an array of the configuration of the according table tablename.

Name

Documentation/

Description

This directory contains the extension manual in ReST format. Documentation/ and its subfolders may contain several ReST files, images and other resources.

Name

Documentation/Index.rst

Description

This file contains the cover page of the extension manual in ReST format. The name or format of the file may not be changed. You may include other ReST files as you like. See the “Extension Template” on docs.typo3.org for more information about structure and syntax of extension manuals.

Name

Resources/

Description

Contains the subfolders Public/ and Private/, which contain resources, possibly in further subfolders, e.g. Templates/, CSS/, Language/, Images/ or JavaScript/.

This is also the directory for non–TYPO3 files supplied with the extension. TYPO3 is licensed under GPL version 2 or any later version. Any non–TYPO3 code must be compatible with GPL version 2 or any later version.

Name

Tests/

Description

This directory contains tests, e.g. unit tests in the subfolder Unit/.

This directory structure is strongly recommended. Extensions may create their own directories (for example, move all language files into other directories).

For the class names in extension files see the chapter “Namespaces and class names of user files”.