Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Imports Analyzer Laravel Package

imanghafoori/php-imports-analyzer

CLI tool to scan Composer-based PHP projects for unnecessary or incorrect use/import statements. Helps clean up imports and enforce coding standards across apps and open-source packages. Install as dev dependency or globally; run check_imports from your project root.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: The package is a standalone CLI tool designed for Composer-based PHP projects, making it compatible with Laravel's standard directory structure and PSR-4 autoloading. However, it lacks Laravel-specific awareness (e.g., facade aliases, service provider auto-discovery), potentially causing false positives for Laravel patterns. Integration occurs at the code analysis layer with no runtime dependencies, fitting cleanly into development workflows.

Integration feasibility: High feasibility via Composer dev dependency. Simple CLI execution (check_imports) works immediately with minimal configuration. Easily integrated into CI pipelines (e.g., GitHub Actions) or pre-commit hooks using standard tooling. No complex setup required beyond Composer installation.

Technical risk: Moderate. Low adoption (21 stars, 0 dependents) and minimal recent activity indicate unproven stability. Generic PHP analysis may produce false positives/negatives for Laravel-specific patterns (e.g., misidentifying facade imports as unused). Risk of breaking changes with newer PHP/Laravel versions if maintenance stagnates.

Key questions:

  • How does the tool handle Laravel's facade aliases and service provider auto-discovery?
  • Does it correctly resolve vendor namespace imports (e.g., Illuminate\Support\Facades\DB)?
  • What is the real-world accuracy rate for detecting "extra" imports in Laravel projects?
  • Are there documented edge cases for dynamic use statements or composer.json class aliases?

Integration Approach

Stack fit: Ideal as a dev-only tool within Laravel's Composer ecosystem. Works with standard Laravel directory structures (app/, src/, etc.) and PSR-4 autoloading. Zero runtime impact on production code. Requires PHP 7.4+ (verify package constraints in composer.json).

Migration path: Start with local validation on a non-critical module. Fix reported issues incrementally. After validation, integrate into CI (e.g., fail builds on critical errors). For large teams, pair with code review guidelines to standardize import practices. Use JSON output for automated fix scripts where possible.

Compatibility: Compatible with Laravel 5.8+ and PHP 7.4+. No known conflicts with common Laravel packages, but facade/alias handling must be tested. Supports --path and --exclude flags for custom directory scanning. Configuration file (php-imports-config.php) allows project-specific rule tuning.

Sequencing:

  1. Install as --dev dependency in Laravel project.
  2. Run manually on a small module to validate output accuracy.
  3. Add to CI pipeline with --format=json for structured reporting.
  4. Gradually expand to all modules, using CI to enforce fixes.
  5. Optional: Implement pre-commit hooks for real-time feedback (e.g., via husky).

Operational Impact

Maintenance: High risk due to low adoption and minimal recent activity. Requires proactive monitoring for compatibility issues with new PHP/Laravel versions. May need internal fixes if the project becomes inactive. Pin to specific versions in composer.json to avoid unexpected breaks.

Support: Limited community support (only 21 stars). Reliance on GitHub issues for troubleshooting. Internal expertise needed to handle false positives or edge cases. Potential for self-maintenance if critical issues arise.

Scaling: Scales linearly with codebase size but may slow on very large projects (>10k files). Performance impact is acceptable for CI pipelines but could require optimization for pre-commit hooks in monorepos. Supports --path filtering to limit scan scope.

Failure modes: False positives could block CI builds unnecessarily; false negatives might miss real issues. Breakage during PHP/Laravel upgrades if the tool isn't maintained. JSON output parsing failures in CI pipelines if format changes unexpectedly.

Ramp-up: Very low for basic usage (simple CLI command). Team requires ~1-2 hours to learn output interpretation and configure CI/pre-commit hooks. Mastery of edge cases (e.g., dynamic imports, wildcard usage) takes 1-2 weeks of real-world use. Documentation is sufficient for initial adoption but lacks advanced scenarios.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport