Author Image

Ruud Silvrants


TYPO3 Wizard. Also magical with Web applications. Always want to help. Has finally domesticated Dachshund Meggie.

Blog Header

Export your composer based extension for non composer TYPO3 installation

Installing an extension which uses composer in a non-composer TYPO3 installation? It is possible, as long as you make your extension autoloading compatible and pull in the dependencies.

Possible problems when using non composer installation

You've created an extension for TYPO3 that uses composer, and now you want to use it in a non-composer TYPO3 installation. The first issue that you run into, is that TYPO3 does not load the class correctly. The second issue is how you get the used libraries and you can still use the benefits of package management (composer). The solution? To make an "archive" of your extension using composer. You can then use this to use TYPO3 in a non-composer installation.

Step 1 - define used PHP libraries

In the `Resources / Private / PHP` folder you create a composer.json file that enters the external php packages. You do not have to add the dependencies on TYPO3 extensions since they are installed separately in TYPO3. After adding your dependencies you can install them via `composer install '.

Step 2 - auto load of classes within the extension

After the packages have been brought in, we still have to call on the autoload so that the packages and classes are available. In TYPO3 it is recommended to do the autoload in "ext_localconf.php". If TYPO3 is not installed via composer, the packages are loaded using the following code:

if (!\TYPO3\CMS\Core\Core\Bootstrap::usesComposerClassLoading()) {
    $composerAutoloadFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY)
        . 'Resources/Private/PHP/autoload.php';

Step 3 - create an archive of the extension

Finally, you need to create an archive/zip package which you can then use to upload your extension to the extension manager or to the TER. This can be done easily via cmdline with the command:

zip -9 -r --exclude=*.git* .

You could optimise this by adding a script to your root composer.json file in your extension. This script will then automatically perform the composer install and archive for you:

"scripts": {
        "package": "cd Resources/Private/ && composer install && cd ../../ && zip -9 -r --exclude=*.git* ."

Sources and example

An example where we used this principle is the Mautic-TYPO3 extension. See the commit:

The idea above is based on the TYPO3 extension:  `` which makes the extension `cocur / slugify` compatible for non composer TYPO3 installation in a similar way.

Please note, the method described above can cause problems in installations where multiple identical packages are used in different extensions. It is advisable, if it allows, to proceed to install TYPO3 via composer.

Read more