📜  composer 列出所有已安装的包 - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:00:00.932000             🧑  作者: Mango

Composer 列出所有已安装的包

如果您正在使用 PHP 项目并使用 Composer 作为依赖管理器,您可能会想知道如何列出您项目中所有已安装的包。

方法

在您的项目根目录下打开终端并运行以下命令:

composer list --installed

您将得到一个包含所有已安装包的列表,类似于下面这个例子:

...
psr/log                          1.1.2    Common interface for logging libraries
ramsey/uuid                      4.1.1    Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).
sebastian/code-unit-reverse-lookup1.0.0    Looks up which function or method a line of code belongs to
sebastian/comparator            3.0.2    Provides the functionality to compare PHP values for equality
sebastian/diff                   3.0.2    Diff implementation
sebastian/environment            4.2.1    Provides functionality to handle HHVM/PHP environments
sebastian/exporter               3.1.0    Provides the functionality to export PHP variables for visualization
sebastian/global-state           4.0.0    Snapshotting of global state
sebastian/object-enumerator      3.0.3    Traverses array structures and object graphs to enumerate all referenced objects
sebastian/recursion-context      4.0.0    Provides functionality to recursively process PHP variables
sebastian/resource-operations    3.0.0    Provides a list of PHP built-in functions that operate on resources
sebastian/version                3.0.1    Library that helps with managing the version number of Git-hosted PHP projects
symfony/console                  v5.2.6   The Console component eases the creation of beautiful and testable command line interfaces.
symfony/finder                   v5.2.6   The Finder component finds files and directories via an intuitive fluent interface.
symfony/polyfill-intl-normalizer v1.22.1  Symfony polyfill for intl's Normalizer class
symfony/polyfill-mbstring        v1.22.1  Symfony polyfill for the Mbstring extension
symfony/polyfill-php80           v1.22.1  Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                  v5.2.6   The Process component executes commands in sub-processes, with a simple and uniform interface.
symfony/yaml                     v5.2.6   The Yaml component loads and dumps YAML files.

您还可以过滤出某个特定的包,例如:

composer list psr/*

这将返回您项目中包含 psr/ 前缀的所有包。

结论

Composer 是一个强大的依赖管理器,有助于您轻松地管理项目依赖项。借助 Composer,您可以方便地列出您已安装的所有包,并快速找到您安装包的详情。