Improve TYPO3 Development with Composer 2.0

Improve TYPO3 Development with Composer 2.0

Woohoo! TYPO3 (aka PHP) people’s long-awaited Composer 2.0 has been launched with lightning-fast speed. In this blog, I want to highlight major features, TYPO3 meets Composer 2.0, an interesting TYPO3 case study for Composer 2.0, What if your TYPO3 project doesn’t support Composer 2.0, etc. As a TYPO3 developer, you should be aware of it. Keep reading!

On 24th Oct, Composer 2.0 was officially announced by team Packagist. By inspiring Susi’s Blog (Miss TYPO3), I want to write an all-in-one TYPO3 + Composer 2.0 blog. If you are new to TYPO3 Composer, then I recommend reading one of my popular blog The Best Guide to TYPO3 Composer.

We are living in Composer-Era. Composer is the backbone of modern development in the TYPO3 landscape. It has been so much easier to pull in open-source as well as private TYPO3 extensions (packages) to your TYPO3 project.

I want to dedicate this blog to the Composer team and people who contribute lots to make TYPO3 compatible with Composer. Honestly, the team composer worked hard and released Composer 2.0 of this incredible piece of software. Big hands to those awesome people who give back to the OpenSource community (both Composer and TYPO3).

Composer 2.0 comes with performance improvements, error reporting improvements, and some features that will help check the compatibility PHP version/extensions at runtime. Explore All Features.

Composer 2.0 - Because Speed Matters

A major goal of Composer 2.0 was to improve as lightning super fast, here is the official test-drive by the composer team.

What/Why Composer is needed for TYPO3?

The Composer was a milestone in TYPO3’s history, such as TYPO3 v9. Composer allows us (TYPO3 Developers) to stop duplicating code and start reusing it in an easy and fast way. Today you can find an incredible number of TYPO3 extensions, and with one command, you can install them in your TYPO3 project. I am sure that without Composer, TYPO3 wouldn’t be the same.

What’s wrong with Composer 1.0 (History)

The composer was released more than 8 years ago which is a predecessor of PEAR which is a PHP package manager. The composer has become the de facto package manager for most of the PHP projects including TYPO3.

Composer although have served well, however, there has always been an issue with performance and memory consumption. The Composer version 2 aims to be more performant in terms of memory and faster download time.

When TYPO3 Meets Composer 2.0 (Case-Study)

I tried out Composer 2 and compared it with Composer 1 in a TYPO3 project executing the various tasks which are used on a general TYPO3 project.

Case 1. Create New TYPO3 Project


composer create-project “typo3/cms-base-distribution:^10” YourProjectName --prefer-dist

Case 2. Install New TYPO3 Extension


composer require nitsan/ns-backup

Case 3. Uninstall TYPO3 Extension


composer remove nitsan/ns-backup

Case 4. Install TYPO3 dependencies with composer.lock


composer install

Case 5. Update TYPO3 Core


composer update --with-dependencies

How’s the PHP Compatibility with Composer 2.0

Composer 2.0 still supports PHP 5.3+ but the team Composer is planning to remove support for older versions of PHP in future minor releases because they feel it’s really outdated and makes the code quite hard to maintain in places.

You can expect the Composer to only work on PHP 7.1 or later from Composer 2.2. So, it’s better to upgrade your TYPO3 projects to the latest PHP by that time!

Install & Upgrade Composer 2.0

If you are looking to freshly install Composer 2.0, then check How to install the Composer section.

Are you excited to upgrade your Composer 1 to Composer 2.0? Open your terminal and try the below commands.


// to try the latest RC version (2.x).
composer self-update --preview

// to try the latest dev build (2.x).
composer self-update --snapshot

// to go back to stable releases (1.x for now).
composer self-update --stable

// in CI/scripts, if you want to pin Composer to 1.x until you are ready to migrate, this will ensure you stay on 1.x releases even once a 2.0 stable comes out.
composer self-update --1


Upgrade to Composer 2.0


// To upgrade, the following command should be executed:
composer self-update --2


Downgrade to Composer 1.0


// Aha, If your TYPO3 project not compatible with Composer 2, you can roll back to Composer 1
composer self-update --1

As a TYPO3 Developer, What care is needed to support Composer 2.0?

As a TYPO3 developer, you don’t need to pay extra care to support Composer 2.0. It means you don’t need to make any changes to your composer.json.

But, in some cases, you might get the following error.

“You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.”

Then make sure, your all dependent TYPO3 extensions have properly configured and support Composer 2.0 as below.


"require": {
    "composer-plugin-api": "^1.0 || ^2.0"

"require-dev": {
    "composer/composer": "1.6.* || 2.0.*",
    "composer/semver": "1.0.* || 2.0.*",


In a worst-case scenario, You can continue with composer 1.0 to keep work on your TYPO3 project ;)

What if 3rd party TYPO3 extensions don’t support Composer 2.0?

Good thing is that Composer 2 is providing backward compatibility. The one issue you're most likely to encounter when upgrading to Composer 2 is having Composer TYPO3 extensions that don't support this newer version yet.

The ideal solution would be upgrading those TYPO3 extensions to newer versions (or submitting a feature request to the TYPO3 extension’s developers to support Composer 2). But if that's not feasible you can actually co-install both Composer 1 and Composer 2 by following these steps:

Step 1. Install composer v1 separately


sudo cp `which composer` /usr/local/bin/composer1 
sudo composer1 self-update --1


Step 2. Upgrade Composer to v2


sudo composer self-update --2


Step 3. Add composer v2 alias (optional)


sudo ln -s `which composer` /usr/local/bin/composer2

TYPO3 Community Wants You

As a give back to the TYPO3 community, Please ensure your TYPO3 extensions which are published at TER (TYPO3 Extensions Repository) will support Composer 2.0 :)


Thanks for reading my blog.

I hope you learned and enjoy the journey of TYPO3 & Composer 2.0. Let’s have a quick recap.

  • First of all, You should update your composer with `composer self-update --2` to get lightning-fast speed into your TYPO3 project.
  • Test-drive Composer 2.0 with your new & existing TYPO3 project.
  • As TYPO3 developer and CLI-users, Read all features available in Composer 2.0
  • In case, If your TYPO3 project causes compatibility issues with Composer 2.0, then either set up both Composer versions or just rollback to Composer 1.0 for a while.
  • Last but not least, Make sure your published TYPO3 extensions are supporting awesome Composer 2.0.

Have a Happy TYPO3 with Composer 2.0!

Post a Comment

Captcha Code Can't read the image? Click here to refresh
  • user
    Felix Flügel 2020-12-01 at 11:09 am
    Cool demo of Composer 2.0 with TYPO3! I loved how you covered the blog with various conditions. Keep up the good work. Thanks
  • user
    Leo Rothmann 2020-12-01 at 10:52 am
    Thanks, Sanjay for quick insights on using composer 2.0 with TYPO3. Indeed Composer 2.0 brings better speed!