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

Laravel Auto Discoverer Laravel Package

spatie/laravel-auto-discoverer

Fast, cached discovery of PHP structures in your codebase. Find classes, interfaces, traits, and enums by conditions like “implements interface” or “uses trait,” and get rich metadata. Ideal for automation, registration, and scanning in production.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic Code Discovery for Plugin/Module Systems: Enable rapid development of extensible architectures (e.g., plugins, themes, or domain-specific modules) where components must auto-discover classes implementing contracts (e.g., PluginServiceProvider, ThemeRenderer). Reduces manual registration boilerplate.
  • Roadmap: Self-Healing Architecture: Build systems where invalid or missing implementations are auto-detected (e.g., "No PaymentGateway implements Chargeable"). Integrate with health checks or CI pipelines.
  • Build vs. Buy: Avoid reinventing wheel for recursive class scanning (e.g., replacing custom glob() + Reflection logic). Justifies OSS adoption over proprietary tools for PHP ecosystems.
  • Use Cases:
    • Laravel Packages: Auto-register service providers, commands, or event listeners based on discovered traits/interfaces (e.g., RegistersRoutes).
    • Testing: Generate test doubles or mocks for all classes implementing ShouldBeTested.
    • Documentation: Dynamically generate API docs or class indexes (e.g., "All Serializable models").
    • Migration Tools: Identify classes using deprecated methods/attributes (e.g., #[Deprecated]).

When to Consider This Package

  • Adopt if:
    • Your PHP/Laravel app has >50 classes and manual discovery (e.g., hardcoded arrays) is unsustainable.
    • You need runtime flexibility (e.g., plugins loaded without server restarts).
    • Performance is critical: Cache-driven discovery avoids repeated Reflection scans in production.
    • Your team prioritizes developer experience (e.g., reducing "Where is this class used?" debugging).
  • Look elsewhere if:
    • You’re using non-PHP languages (e.g., Node.js, Go).
    • Your discovery needs are static (e.g., compile-time tooling like phpstan or psalm).
    • You require binary-level analysis (e.g., parsing compiled bytecode; use nikic/php-parser or phpstan).
    • Your app is tiny (<20 classes) and hardcoding is simpler.
    • You need cross-framework support (e.g., Symfony + Laravel; this is PHP/Laravel-specific).

How to Pitch It (Stakeholders)

For Executives: "This package eliminates technical debt from manual class discovery, enabling faster feature delivery and plugin ecosystems. For example, a plugin marketplace could auto-load extensions without manual configuration—reducing onboarding friction by 80%. The built-in caching ensures zero performance impact in production, and its open-source nature aligns with our cost-efficiency goals."

For Engineering: *"Replace your custom glob() + Reflection hacks with a battle-tested, cache-optimized solution. Key benefits:

  • Zero boilerplate: Discover classes by traits/interfaces in one line (e.g., Discover::in(app_path())->implementing(Serializable::class)->get()).
  • Production-ready: Caching avoids runtime overhead; warm caches on deploy with php artisan structure-scouts:cache.
  • Extensible: Custom conditions (e.g., namespace === 'App'), parallel scanning, and chain resolution for inheritance.
  • Laravel-native: Integrates with Artisan commands and config publishing. Use case: If you’re building a modular monolith or package, this cuts discovery code from 50+ lines to 5."*

For Developers: *"Say goodbye to foreach (glob(app_path('*/*.php'))) hell. This package gives you:

  • Fluent API: Chain conditions like classes()->withAttribute(Cacheable::class)->sortBy(Sort::Name).
  • Debugging superpowers: Get full metadata (e.g., isAbstract, extendsChain) for introspection.
  • Parallel mode: Scan 10K+ files in seconds with parallel(). Example: Find all #[ApiResource] classes in your API layer instantly."*
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.
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
anil/file-picker
broqit/fields-ai