Coder Social home page Coder Social logo

composer-unused's Introduction

composer-unused

Show unused packages by scanning your code

Motivation

Working in a big repository with multiple people, sometimes you might lose track of you required composer packages. You have so many packages you can't be sure if they are used or not.

You can use composer why package/A but that only gives you information about why this package is installed in dependency to another package.

What if you need to find out if the provided namespaces of the package are used in your code?

composer unused to the rescue!

usage

Installation

Run

$ composer global require icanhazstring/composer-unused

Usage

Run

$ composer unused

Exclude folders and packages

Sometimes you don't want to scan a certain dir or ignore a composer package while scanning. For this you can provide the --excludeDir|-xd or the --excludePackage|-xp parameter.

$ composer unused --excludeDir=config --excludePackage=symfony/console

Make sure the package is named exactly as in your composer.json

You can provide multiple folders and package by repeating the argument.

Troubleshooting

If you encounter some errors, try running

$ composer unused -vvv

This will enable debug mode and create an error report beside your composer.json.

composer-unused-dump-YmdHis

Example (doctrine/orm)

vagrant@ubuntu-bionic:/vagrant/doctrine/orm$ composer unused

Loading packages
----------------

 Loading 15 requirements
 15/15 [-----------------------------] 100%

 ! [NOTE] Skipped 2 requirements. No package found or invalid constraint.                                               

 * php
 * ext-ctype

 ! [NOTE] Found 13 packages to be checked.                                                                              

Scanning files...
-----------------

 1174/1174 [-----------------------------] 100%

Found 13 used and 0 unused packages

Results
-------

 Used packages
 * doctrine/annotations ✓
 * doctrine/cache ✓
 * doctrine/collections ✓
 * doctrine/dbal ✓
 * doctrine/event-manager ✓
 * doctrine/inflector ✓
 * doctrine/instantiator ✓
 * doctrine/persistence ✓
 * doctrine/reflection ✓
 * ocramius/package-versions ✓
 * ocramius/proxy-manager ✓
 * symfony/console ✓
 * symfony/var-dumper ✓

 Unused packages

Changelog

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

Code of Conduct

Please have a look at CODE_OF_CONDUCT.md.

License

This package is licensed using the MIT License.

composer-unused's People

Contributors

finagin avatar icanhazstring avatar machour avatar seriquynh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.