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 Structure Discoverer Laravel Package

spatie/php-structure-discoverer

Discover PHP classes, interfaces, traits, and enums that match conditions (e.g., implement an interface) across your project. Fast scanning with built-in caching and rich metadata—ideal for auto-registration, tooling, and framework integrations.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Codebase Discovery & Metadata-Driven Features:

    • Enables dynamic discovery of classes, interfaces, enums, and traits for features like auto-generated documentation, dependency mapping, or codebase analytics.
    • Example: Build a "Codebase Explorer" tool for developers to visualize class hierarchies, inheritance chains, or attribute usage.
  • Build vs. Buy for Custom Tooling:

    • Avoid reinventing wheel for static analysis tools (e.g., finding all classes implementing Serializable or using @Cacheable).
    • Reduces maintenance overhead compared to custom scripts (e.g., regex-based searches or get_declared_classes() hacks).
  • Performance Optimization for Large Codebases:

    • Caching eliminates repeated filesystem scans in production (critical for CLI tools or scheduled jobs).
    • Parallel scanning accelerates discovery in monorepos or legacy apps with thousands of files.
  • Laravel-Specific Use Cases:

    • Dynamic Service Providers: Auto-register classes implementing Illuminate\Contracts\Auth\Authenticatable without manual configuration.
    • Migration Generators: Discover all Model subclasses to auto-generate migrations for new fields.
    • Testing Utilities: Find all test classes in tests/Unit/ to dynamically generate test reports.
  • Roadmap for "Self-Healing" Codebases:

    • Power linters or refactoring tools to flag unused interfaces/enums or broken inheritance chains.
    • Enable "dead code" detection by analyzing unused discovered structures.

When to Consider This Package

  • Avoid if:

    • Your codebase is tiny (<100 classes): Overkill for simple projects; manual get_declared_classes() suffices.
    • You need real-time analysis (e.g., IDE plugins): Filesystem scans introduce latency; consider PHPStan or Psalm for static analysis.
    • Performance is critical in development: Parallel scanning adds CPU overhead; disable caching for iterative work.
    • You’re not using PHP/Laravel: The package is PHP-centric (no JS/TS/Go support).
  • Look Elsewhere if:

    • You need semantic understanding (e.g., "find all methods using Carbon"): Combine with PHP Parser or Nikic’s PHP-Reflection.
    • Database schema discovery is needed: Use Doctrine DBAL or Laravel Schema.
    • You require cross-language analysis: Tools like SourceGraph or GitHub’s Code Search are better fits.

How to Pitch It (Stakeholders)

For Executives (TL;DR)

*"This package lets us automate codebase introspection—like a ‘Google for our PHP classes’—to build tools that save dev time. For example:

  • Auto-generate API docs by scanning all @ApiResource classes.
  • Cut migration time by auto-discovering all Eloquent models.
  • Reduce tech debt by flagging unused interfaces or broken inheritance. It’s low-risk (MIT license, battle-tested by Spatie), scalable (caching + parallel scans), and future-proof for tools like AI-assisted refactoring. Investment: ~1 dev day to integrate; ROI: weeks of saved manual work."*

For Engineers

*"This is a Swiss Army knife for codebase metadata. Key wins:

  • Replace ad-hoc scripts: No more grep/find hacks to list classes implementing ShouldBeCached. Just:
    Discover::in(app_path())->implementing(ShouldBeCached::class)->get();
    
  • Build reusable infrastructure: Cache discovery results for CLI tools, tests, or deploy scripts.
  • Leverage Laravel’s ecosystem: Works seamlessly with Artisan commands, caching, and config.
  • Performance out of the box: Parallel scans + caching make it fast in production.

Tradeoffs:

  • Not a silver bullet for deep static analysis (e.g., method-level logic).
  • Requires initial setup (configuring directories, cache drivers).

Proposal: Pilot this for one high-impact use case (e.g., auto-generating model factories) to validate ROI before scaling."*

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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope