Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer: how to know a package by what other package is required

Tags:

composer-php

I've found nesbo/carbon in my vendor folder. It is a really useful library and I'm curious to know which other package I installed requires it.

How can I know this?

like image 255
Aerendir Avatar asked Jan 30 '17 16:01

Aerendir


People also ask

How do I check my composer dependencies?

My solution was to search the composer. lock file for the abandoned package name. It will appear in require or require-dev for the package that depends on it.

Where does composer Look for packages?

Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer.

What command shall be used to show which package's prevent the given package from being installed?

#prohibits (why-not) The composer prohibits command tells us which packages are preventing a given package from being installed.

What is composer global require?

In a nutshell, cgr (named after “composer global require”) is a drop-in replacement for the composer global require command which can be used for installing PHP command line tools globally that is functionally equivalent (nearly) to the existing command, but much safer.


1 Answers

Lets look at composer why or composer depends command. This command shows which other packages depend on a certain package. Show usage

This is usage example

 $ composer depends psr/log  symfony/debug  v3.2.2  requires  psr/log (~1.0)   
like image 184
Bukharov Sergey Avatar answered Oct 31 '22 18:10

Bukharov Sergey