How to Install a Specific Version of a Package with Composer?

Susan Sarandon
Release: 2024-11-09 10:49:02
Original
628 people have browsed it

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
Copy after login

For instance, to install version 0.10.2 of the "refinery29/test-util" package, run:

composer require refinery29/test-util:0.10.2
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template