sagautam5 / composer-insights
CLI tool to audit and analyze your composer dependencies.
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.0
- nesbot/carbon: ^3.9
- symfony/console: ^6.0 || ^7.0
Requires (Dev)
- pestphp/pest: ^3.8
This package is auto-updated.
Last update: 2025-06-29 17:46:50 UTC
README
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
vendor\bin\composer-insights analyze --export=json
vendor\bin\composer-insights analyze --export=csv
π 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
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
andcomposer.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
- Sagar Gautam β Creator & Maintainer
- ALL Contributors
Enjoy analyzing your dependencies! π