Home > Article > Backend Development > How to Install a Specific Version of a Package with Composer?
Installing a Specific Version of a Package with Composer
When attempting to install a specific version of a package using Composer, the default commands ("composer install" and "composer require") typically fetch the latest version. However, there are occasions when an older version is preferred.
Solution: Using the Composer Require Command
To install a specific package version, use the following syntax:
composer require vendor/package:version
For instance, to install version 0.10.2 of the "refinery29/test-util" package, run:
composer require refinery29/test-util:0.10.2
By specifying the version number after the package name, Composer will fetch and install that specific version, allowing you to control the precise package version you want to use in your project.
The above is the detailed content of How to Install a Specific Version of a Package with Composer?. For more information, please follow other related articles on the PHP Chinese website!