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

Contracts Laravel Package

composer-unused/contracts

Shared contract interfaces used by composer-unused. This package provides the stable API boundary between composer-unused components, enabling versioned compatibility and easier extension without depending on the full application.

View on GitHub
Deep Wiki
Context7

Getting Started

This package provides interfaces (contracts) used by composer-unused, a tool to detect unused Composer dependencies. As a developer, you’ll rarely interact with it directly — it’s consumed by the main composer-unused CLI tool. To begin:

  1. Install the tool via composer require --dev composer-unused/composer-unused.
  2. Run vendor/bin/composer-unused to scan your project for unused dependencies.
  3. Review the output and update your composer.json accordingly.
    The composer-unused/contracts package is installed transitively as a dependency and contains interfaces like FilterInterface, ReportInterface, and DependencyInterface — only relevant if you’re extending or customizing the tool.

Implementation Patterns

  • Custom Reporters: Implement composer_unused/contractsReportInterface to generate custom output formats (e.g., JSON, GitHub Actions annotations, or Markdown summaries).
  • Dependency Filters: Create classes implementing FilterInterface to exclude specific dependencies (e.g., dev-only packages, framework internals) from analysis.
  • Integrations: Use in CI via custom GitHub Actions or pre-commit hooks; the contracts ensure stable API surface for integrations even as the tool evolves.
  • Testing: Write unit tests that mock or implement contract interfaces to validate your custom scanner logic (e.g., verifying a new filter works with real PackageInterface instances).

Gotchas and Tips

  • Version Lock: Since contracts are MIT and stable, version pinning isn’t strictly needed — but avoid ^2.0 without verifying compatibility with your version of composer-unused.
  • Interface Stability: The project uses stable interfaces — but always check the CHANGELOG of composer-unused/composer-unused when upgrading, as breaking changes may ripple into the contracts.
  • DI Containers: When building custom implementations, ensure your filter/reporter classes are auto-wired or explicitly bound in the tool’s DI container (usually via src/Config.php or CLI options).
  • No Direct Usage: You almost never call new SomeContract() — the contracts only matter when extending. If your project doesn’t require customization, ignore this package entirely.
  • Debugging: Enable verbose mode (-vvv) in composer-unused to see how filters/reports are instantiated — helpful when your custom implementation isn’t invoked.
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
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
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests