Packagist: Which package use mine as a dependency? (English)

2014-02-23

  symfony    english    packagist    composer 

I wanted to know which (open-source) packages used my library package (a Symfony bundle registered on Packagist) as a dependency.

Inside a project using Composer, you can execute the following command in order to answer this question among registered packages inside your composer.json file:


$ php composer.phar depends monolog/monolog
symfony/monolog-bundle requires monolog/monolog (~1.6)
symfony/symfony requires (dev) monolog/monolog (~1.3)

I wanted something doing the same but not just inside a project: over all packages (24 658 packages at this time) available on Packagist so I've written the following Python script:

Its use is quite simple. Firstly, you just have to fetch the dependencies of each packages with the following command:


$ ./packagist.py --fetch
Packages dependencies has been dumped into packages.json file.

Then, you can perform your reverse-search for a given package with the command below:


$ ./packagist.py --package eko/feedbundle
{
    "require": [
        "cobase/cobase",
        "symfony-cmf/sandbox"
    ],
    "require-dev": [],
    "suggest": [
        "symfony-cmf/block-bundle"
    ]
}

That's useful and permit to determine the use of a library in the open-source community.

Comments