Get Information About Installed PHP Package using Composer

Get Information About Installed PHP Package using Composer

There may be times when you need to retrieve information about a specific installed PHP package, such as its version, dependencies, or even the package's source code repository. By knowing the versions and dependencies of each package, you can ensure that your project remains compatible and stable. This knowledge allows you to make informed decisions when updating or modifying packages, avoiding potential conflicts or breaking changes. This tutorial shows how to get information about installed PHP package using Composer.

The composer show command can be used to retrieve details of an installed package. This includes information such the package name, version number, description, homepage, license, dependencies, and other relevant metadata.

For example, the following command retrieves information about symfony/http-client package:

composer show symfony/http-client

Here's an example output of the command:

name     : symfony/http-client
descrip. : Provides powerful methods to fetch HTTP resources synchronously or asynchronously
keywords : http
versions : * v5.4.23
type     : library
...
requires
php >=7.2.5
psr/log ^1|^2|^3
symfony/deprecation-contracts ^2.1|^3
...

Leave a Comment

Cancel reply

Your email address will not be published.