TYPO3 Extension Composer Repository

What Is It?

This is a Composer repository, enabling you to install TYPO3 extensions from the TYPO3 Extension Repository (TER) including their TER dependencies via Composer.

This repository includes only the following TYPO3 CMS extensions:

  • All TYPO3 Extensions that are uploaded to TER, including insecure versions.
    • Insecure versions are marked in th extra section with "extra""typo3/ter""reviewstate" = "insecure" in the composer extra section
    • All these extensions are in the typo3-ter/ composer namespace

You can list and search for available extension packages.

Please note, that some extension authors already published their extensions on Packagist. If this is the case, prefer to use these, rather than this repository.

How to use it?

As a quick way to use Composer, the Base Distribution can be downloaded. It is assuming you have Composer already installed on your system:

# Download the Base Distribution, the latest "stable" release (8.7)
composer create-project typo3/cms-base-distribution CmsBaseDistribution

# Download the Base Distribution, the "dev" branch (9.x)
composer create-project typo3/cms-base-distribution CmsBaseDistribution dev-master

As a second step, we are going to add additional packages. The commands must be run from inside the CmsBaseDistribution directory.

# Add a CMS extension into typo3conf/ext.
composer require typo3-ter/static-info-tables

# Add a package from outside the TYPO3 world
composer require monolog/monolog

# Personalize your composer.json file to your needs.
edit composer.json

Using composer to install TYPO3 CMS is fairly simple, you just need to include the custom composer repository into your composer.json. After you have done this, you can require TER extensions with the usual composer versioning format.

In the example below, this will always get you the most current 8.7.x core of TYPO3 CMS, the most current version of news (including possible dependency!). Pay attention to replace underscores "_" by a dash "-" in the extension key. As example, extension "tt_news" will be "tt-news" in the composer.json.

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://composer.typo3.org/"
        }
    ],
    "require": {
        "typo3/cms": "^8.7",
        "typo3-ter/static-info-tables": "^6.4.3"
    },
    "extra": {
        "typo3/cms": {
            "cms-package-dir": "{$vendor-dir}/typo3/cms",
            "web-dir": "web"
        }
    }
}

Add your own composer.json file

It is encouraged to add your own composer.json file in your extension to be on the good side, as TYPO3 CMS will rely more and more on Composer to handle dependencies. The file must be placed at the root of your extension and must look like as follows:

{
    "name": "vendor-name/my-ext-key",
    "type": "typo3-cms-extension",
    "description": "My description comes here",
    "homepage": "https://example.com",
    "license": ["GPL-2.0+"],
    "keywords": ["TYPO3 CMS", "foo bar"],
    "support": {
        "issues": "https://forge.typo3.org/projects/extension-my_ext_key"
    },
    "require": {
        "typo3/cms-core": "^7.6.0 || ^8.7.0"
    },
    "autoload": {
        "psr-4": {
            "VendorName\\MyExtKey\\": "Classes/"
        }
    },
    "replace": {
        "my_ext_key": "self.version",
        "typo3-ter/my-ext-key": "self.version"
    },
    "extra": {
        "typo3/cms": {
            "extension-key": "my_ext_key"
        }
    }
}

The vendor-name must be one of yours. It must not be "typo3" which is reserved for Core extensions. There are some conventions notes available in the TYPO3 Wiki related to namespaces.

Extensions on Packagist

Once you added a composer.json file, it is highly recommended to register your extensions on Packagist.

It is also recommended to include extensions directly from Packagist instead of using this Composer repository. For example, better require georgringer/news than typo3-ter/news, if you want the News extension in your composer installation.

How does it work?

A few times a day we crawl the TYPO3 Extension Repository. We process all ext_emconf.php's to calculate the dependencies. We generate the metadata (packages.json), needed by composer to find the right downloads which will be downloaded from the TER eventually.

[4]: https://git.typo3.org/Sites/ComposerTypo3Org.git