How to Install Specific Package Versions with Composer?

Mary-Kate Olsen
Release: 2024-11-19 03:21:02
Original
371 people have browsed it

How to Install Specific Package Versions with Composer?

Installing Specific Package Versions with Composer

Composer is a dependency manager for PHP that simplifies the installation and management of third-party packages. When installing a package, Composer typically installs the latest available version by default. However, there may be scenarios where a specific version of a package is required. This article provides a solution for installing a specific version of a package using Composer.

To install a specific version of a package, use the following syntax:

composer require vendor/package:version
Copy after login

In this syntax, "vendor/package" represents the vendor and package name, and "version" specifies the desired version. For example, to install version 0.10.2 of the "refinery29/test-util" package, use the following command:

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

By using this method, you can precisely control the version of a package installed in your project, ensuring compatibility with other dependencies or specific project requirements.

The above is the detailed content of How to Install Specific Package Versions 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