TYPO3 & Composer: A Simple Guide for Developers

in #typo3 • 6 days ago

TYPO3 projects often rely on several packages and Extensions working together. TYPO3 Composer helps manage these requirements while keeping versions and dependencies in check. This guide covers the main steps for a cleaner TYPO3 setup.

Install-TYPO3-with-Composer.jpg

Why Use Composer with TYPO3?

Composer helps you manage your project from one place:

  • Install TYPO3 Core and packages
  • Add or remove Extensions
  • Manage dependencies
  • Control package versions
  • Check updates and security issues

Create a TYPO3 Project

For a new TYPO3 v14 project, run:

composer create-project "typo3/cms-base-distribution:^14" my-typo3-project
cd my-typo3-project

For TYPO3 v13, replace ^14 with ^13.

Set public/ as the web server's document root, then complete the setup:

./vendor/bin/typo3 setup

Make sure your PHP version, database, Composer, and required PHP Extensions are supported.

Add and Remove Extensions

Install an Extension with:

composer require vendor/package

Remove it with:

composer remove vendor/package

After changing Extensions, run:

./vendor/bin/typo3 extension:setup

Always check Extension compatibility before installation.

Important Composer Files

composer.json defines the packages and version requirements for your project.

composer.lock records the exact versions installed, helping keep environments consistent.

vendor/ contains Composer-managed packages and should not be committed to Git.

Update Your TYPO3 Project Safely

Before making major changes, back up your project and test updates on staging.

Useful commands include:

composer outdated
composer audit
composer validate

Use controlled version constraints instead of * to reduce unexpected updates.

Fix Common Composer Problems

Dependency conflicts, unsupported PHP versions, wrong package names, and incompatible Extensions can cause errors. composer diagnose can check the Composer setup, while composer why-not helps find dependency conflicts.

Conclusion

TYPO3 Composer makes dependency and Extension management much easier. By keeping versions controlled and testing updates before deployment, developers can maintain TYPO3 projects with better stability and less manual work.