typo3-extension-workshop/Documentation/source/StartNewExtension.rst

2.1 KiB

Start new extension

Necessary files

The only necessary file is ext_emconf.php. This configures the Extension Manager. Without this file, the Extension Manager would not recognize the extension and would prevent installation.

../../CodeExamples/localPackages/example_extension/ext_emconf.php

See t3coreapi:extension-declaration in TYPO3 Core API Reference.

Task

So let's create a new folder and add the file.

Install extension

Once we have created the first extension, we need to install the extension. There are two ways for a local extension. Either placing the extension inside the installation, or via composer.

Task

Install the new extension.

Oldschool

Add note about autoloading.

Copy the extension to typo3conf/ext/, and head over to Extension Manager to activate the extension.

Via Composer

The following project setup is suggested:

.
├── composer.json
└── localPackages
    └── example_extension

composer.json:

../../CodeExamples/composer.json

In this case, we also need a composer.json inside our extension, to make the extension an composer package and allow the installation:

composer.json:

../../CodeExamples/localPackages/example_extension/composer.json

Thanks due typo3-console/composer-auto-commands our extension is activated already.

Autoloading

Using composer, TYPO3 does not do any special. The autoloading is provided by composer and can be configured as documented by composer.

If you are not using composer, you should provide autoloading information inside ext_emconf.php:

../../CodeExamples/localPackages/example_extension/ext_emconf.php

There you can follow the composer autoloading configuration.

You can find the composer documentation about autoloading at https://getcomposer.org/doc/04-schema.md#autoload .