Posts Learn Components Snippets Categories Tags Tools About

How to Switch PHP Composer Versions

Learn how to easily change between composer versions through your command line terminal

Created on Jul 04, 2021


Sometimes you might need to change your composer version to meet the requirement of the project you are working on. But how to do that and is it even possible? The answer is yes it's possible and below are the commands to switch between composer versions 1 and 2.

Switch Composer to Version 1
If you are currently on version 2 then you can run the command like below to change to version one.
composer self-update --1

Switch Composer to Version 2
Otherwise, if you are already on version 1 then you can specify the version 2.
composer self-update --2

Do note that the "--1" or "--2" version flag is necessary to indicate the version you are switching into.

Switch to Specific Version Number
To switch the version to a specific one you can pass on the exact version number as required like below.
composer self-update 1.10.22
composer self-update 2.1.3

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to Switch PHP Composer Versions