What happens if your project still requires Composer 1?
If yourcomposer.json specifies a constraint like ^1 for the Composer runtime, your build
on Upsun or Platform.sh will fail.Here’s the kind of error you’ll see:
How to check your Composer version
To check your current Composer version, execute the following:Composer version 1.x.x, you are running the deprecated version.
How to upgrade your project to Composer 2
Upgrading is straightforward:1. Update globally (recommended)
If Composer is installed globally on your system:2. Install via Package Manager
For example, on macOS with Homebrew:3. Use the official installer
If you installed Composer manually:Actions to take in your project
- using Upsun
- using Platform.sh
-
Update your
composer.jsonUpdate the required PHP version and add a runtime API requirement to enforce Composer 2:Your current PHP version is maybe outdated?
Composer 2 requires at least PHP 7.2.5, but many modern packages no longer support versions below PHP 8.1. To ensure long-term compatibility, security, and access to the latest ecosystem improvements, we strongly recommend upgrading to PHP 8.2 or higher. -
Check your
.upsun/config.yamlEnsure you declare Composer 2 in your.upsun/config.yamlconfiguration, or, as Composer version 2 is now the default version installed on every project, completely remove the Composer dependency: -
Test dependency resolution
Run
composer updatewith Composer 2 and commit the updatedcomposer.lock. In rare cases, some legacy packages may need adjustments: -
Update your CI/CD pipelines
Check your Docker images, GitHub Actions, or other CI jobs. Many older PHP images still ship with Composer 1 by default.- For Docker, use the
composer:2official image. - For GitHub Actions, specify a step to upgrade Composer.
- For Docker, use the
-
Communicate the change
Update your project’s documentation to state that Composer 2 is required.
Troubleshooting common migration issues
Upgrading from Composer 1 to 2 is usually seamless, but you may encounter issues:-
API Rate Limits (GitHub, GitLab, etc.)
Composer 2 uses parallel downloads which can trigger API rate limits. Solution: configure OAuth tokens for GitHub or GitLab in yourauth.json. -
Plugins Not Compatible
Some Composer plugins written for v1 may not work on v2. Ensure you update plugins to their latest version, or replace them if no update is available. -
Stricter Dependency Checks
Composer 2 is stricter about dependency resolution. If you encounter errors, check yourcomposer.jsonfor constraints that need adjusting. -
CI/CD Caching Issues
Clear your Composer cache in CI/CD environments (composer clear-cache) if builds fail after upgrading.
Conclusion
Composer 1 is officially unsupported. By upgrading to Composer 2, you get:- Faster dependency resolution
- Modern PHP compatibility
- A safer, future-proof environment