Create an extension

For an extension to be installable in TYPO3 it needs a file called composer.json. You can read more about this file here: composer.json.

A minimal composer.json to get the extension up and running could look like this:

EXT:tea/composer.json
{
    "name": "ttn/tea",
    "description": "TYPO3 example extension for unit testing and best practices",
    "type": "typo3-cms-extension",
    "authors": [
        {
            "name": "Oliver Klee",
            "email": "typo3-coding@oliverklee.de",
            "homepage": "https://www.oliverklee.de",
            "role": "maintainer"
        },
        {
            "name": "Daniel Siepmann",
            "email": "coding@daniel-siepmann.de",
            "homepage": "https://daniel-siepmann.de/",
            "role": "maintainer"
        },
        {
            "name": "\u0141ukasz Uzna\u0144ski",
            "email": "lukaszuznanski94@gmail.com",
            "homepage": "https://uznanski.pl/",
            "role": "maintainer"
        }
    ],
    "homepage": "https://extensions.typo3.org/extension/tea/",
    "support": {
        "issues": "https://github.com/FriendsOfTYPO3/tea/issues",
        "source": "https://github.com/FriendsOfTYPO3/tea",
        "docs": "https://docs.typo3.org/p/ttn/tea/main/en-us/"
    },
    "require": {
        "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
        "psr/http-message": "^1.0.1",
        "typo3/cms-core": "^11.5.4 || ^12.4",
        "typo3/cms-extbase": "^11.5.4 || ^12.4",
        "typo3/cms-fluid": "^11.5.4 || ^12.4",
        "typo3/cms-frontend": "^11.5.4 || ^12.4"
    },
    "prefer-stable": true,
    "autoload": {
        "psr-4": {
            "TTN\\Tea\\": "Classes/"
        }
    },
    "extra": {
        "typo3/cms": {
            "extension-key": "tea"
        }
    }
}
Copied!
EXT:tea/ext_emconf.php
<?php

$EM_CONF[$_EXTKEY] = [
    'title' => 'Tea example',
    'description' => 'Example extension for unit testing and best practices',
    'version' => '3.1.0',
    'category' => 'example',
    'constraints' => [
        'depends' => [
            'php' => '7.4.0-8.3.99',
            'typo3' => '11.5.4-12.4.99',
            'extbase' => '11.5.4-12.4.99',
            'fluid' => '11.5.4-12.4.99',
            'frontend' => '11.5.4-12.4.99',
        ],
    ],
    'state' => 'stable',
    'uploadfolder' => false,
    'createDirs' => '',
    'author' => 'Oliver Klee, Daniel Siepmann, Łukasz Uznański',
    'author_email' => 'typo3-coding@oliverklee.de, coding@daniel-siepmann.de, lukaszuznanski94@gmail.com',
    'author_company' => 'TYPO3 Best Practices Team',
    'autoload' => [
        'psr-4' => [
            'TTN\\Tea\\' => 'Classes/',
        ],
    ],
    'autoload-dev' => [
        'psr-4' => [
            'TTN\\Tea\\Tests\\' => 'Tests/',
        ],
    ],
];
Copied!

With just the composer.json present (and for legacy installations additionally ext_emconf.php) you would be able to install the extension but it would not do anything.

Though not required it is considered best practice for an extension to have an icon. This icon should have the format .svg or .png and has to be located at EXT:tea/Resources/Public/Icons/Extension.svg.

Install the extension locally

See Extension installation.