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.
spatie/laravel-auto-discoverer wrapper) and leverages Laravel’s service container, caching, and Artisan commands, making it a seamless fit for Laravel-based architectures.spatie/php-structure-discoverer) is framework-agnostic, allowing it to integrate into non-Laravel PHP applications if needed, though Laravel-specific features (e.g., cache drivers, Artisan commands) are optimized for Laravel.Arrayable models).php artisan vendor:publish) is the only setup required. No database migrations or complex dependencies.structure-scouts:cache, structure-scouts:clear) align with Laravel’s CLI workflows.amphp/parallel for large-scale discovery, reducing runtime for monolithic apps.DiscoverCondition classes for complex filtering.php artisan structure-scouts:cache).structure_scout_directories).php artisan structure-scouts:clear) or integrate with Laravel’s filesystem events.spatie/php-structure-discoverer package directly for non-Laravel projects.vendor/, node_modules/) that should be excluded by default?booted event)?amphp/parallel (optional, for parallel scans).Discover methods.composer require spatie/laravel-auto-discoverer.php artisan vendor:publish --tag="structure-discoverer-config".ShouldBeHidden models).AppServiceProvider) with dynamic discovery where possible.// Before
$this->app->bind('model-registry', function () {
return [ModelA::class, ModelB::class];
});
// After
$this->app->bind('model-registry', function () {
return Discover::in(app_path('Models'))->classes()->get();
});
UserModelScout).bootstrap/app.php or a service provider:
StructureScoutManager::cache(base_path('app'));
debugbar).eval()). Test with your ORM (e.g., Eloquent) or API clients.withAttribute()).classes.json file during deployment.symfony/finder for file-based filtering (lighter but less feature-rich).grep -r "class " app/).implementing(Serializable::class)).updated filesystem events).ignored_files and structure_scout_directories as the codebase evolves.spatie/php-structure-discoverer updates (MIT license allows easy forks if needed).composer dump-autoload.structure_scout_directories.DiscoveredStructure objects (via full()) to inspect metadata for issues.HasApiTokens models").structure-scouts:clear is run post-deployment.How can I help you explore Laravel packages today?