sagautam5/composer-insights

CLI tool to audit and analyze your composer dependencies.

v1.0.0 2025-06-29 17:32 UTC

This package is auto-updated.

Last update: 2025-06-29 17:46:50 UTC


README

GitHub stars Latest Stable Version Total Downloads Issues Forks GitHub Actions Status

Composer Insights is a CLI tool that analyzes your PHP project's composer dependencies and provides insightful GitHub and Packagist statistics for each top-level dependency.

✨ Features

  • πŸ” Analyze direct dependencies from composer
  • ⭐ Fetch GitHub repository data: stars, forks, open issues, last update
  • πŸ“ˆ Get download stats from Packagist
  • 🧹 Clean tabular output in the terminal
  • πŸ›‘ Gracefully skips non-GitHub packages
  • ⚑ Fast, dependency-free CLI experience
  • πŸ“Š Clean color-coded analysis summary

πŸ’‘Example Output

vendor\bin\composer-insights analyze

Sample Console Output

vendor\bin\composer-insights analyze --export=json

Sample JSON Output

vendor\bin\composer-insights analyze --export=csv

Sample CSV Output

πŸ“‹ Requirements

  • PHP 8.2 or higher
  • A Composer-based project
  • Internet connection

πŸ“₯ Installation

You can install it in any Composer-based local PHP project as dev dependency:

composer require sagautam5/composer-insights --dev

Make sure your project has both composer.json and composer.lock files.

To avoid GitHub API rate limits and to enable access to public repositories, set your GitHub token as an environment variable:

export GITHUB_TOKEN=your_github_token

You can generate a personal access token from https://github.com/settings/tokens

πŸ“Έ Screenshots

Classic Token Option

Classic Token Option

Privillages For Token

Privillages For Token

πŸ§ͺ Usage

Run the following command to start the analysis:

vendor/bin/composer-insights analyze

πŸ”§ Command Options for analyze

Here are the available options for the analyze command:

Option Description
--days=180 (Optional) Number of days to look back for health check (default: 180).
--dev Include only development dependencies in the analysis.
--prod Include only production dependencies in the analysis.
--export=FORMAT Export results to a file. Accepts json or csv.
--no-summary Do not show summary statistics in the console output.
--no-table Do not show the table view in the console output.

By default, all dependencies (both production and development) will be analyzed.

πŸ› οΈ What This Command Does

  • Parses your composer.json and composer.lock
  • Analyzes only direct dependencies (ignores transitive)
  • Fetches GitHub and Packagist stats
  • Displays a clean, color-coded CLI table
  • Displays a clean, color-coded summary

πŸͺͺ License

This package is open-sourced under the MIT License.

πŸ” Security

If you discover a security vulnerability within this package, please send an e-mail to sagautam5@gmail.com, All security vulnerabilities will be promptly addressed.

🀝 Contributing

Want to contribute to Composer Insights ? Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

We welcome all contributions, whether it's:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

πŸ™Œ Contributors

Enjoy analyzing your dependencies! πŸŽ‰