Posts Learn Components new Snippets new Categories Tags About Device Beast sponsor
/

How to Switch PHP Composer Versions

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

Created on Jul 04, 2021

19 views

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

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

Load comments for How to Switch PHP Composer Versions

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Other Code Snippets

More