config/app.php).app/Modules/*).config/app.php (e.g., hardcoded paths).app/Providers to modules/Auth/Providers).config/auto-reg.php.composer.json to exclude standard Laravel directories from auto-discovery (if using custom paths).| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Discovery Conflicts | Overlapping glob patterns may register duplicate providers/routes. | Use explicit exclude patterns in config; test with php artisan package:discover. |
| Performance | Scanning large directory trees could slow boot time. | Benchmark with laravel-debugbar; optimize glob patterns (e.g., app/Modules/*/Providers). |
| Laravel Version Drift | Package supports Laravel 8–12, but new Laravel features may break compatibility. | Monitor Laravel minor releases; test against the latest LTS version. |
| Edge Cases | Non-standard file naming (e.g., Provider.php vs. AuthServiceProvider.php). |
Configure custom file extensions or naming rules in the package config. |
| Testing Overhead | May require updating integration tests if directory structures change. | Adopt a contract-first approach (e.g., test registrations via ServiceProvider::booted()). |
config/app.php) that could conflict?laravel-debugbar.)config/app.php.)| Phase | Actionable Steps | Validation Check |
|---|---|---|
| Assessment | Audit current config/app.php and directory structure. |
List all manually registered providers/routes; identify duplicates or gaps. |
| Pilot | Test with one component type (e.g., routes) in a staging environment. | Verify routes are registered without conflicts; check php artisan route:list. |
| Incremental Rollout | Expand to providers, configs, and migrations in phases. | Use php artisan package:discover --verbose to debug registration issues. |
| Full Adoption | Replace manual registrations with package config; clean up obsolete entries. | Run php artisan optimize:clear; test all features. |
| Optimization | Fine-tune glob patterns for performance; add exclusions for edge cases. | Profile boot time with laravel-debugbar. |
AuthServiceProvider, custom providers).routes/web.php and routes/api.php from custom paths.database/migrations-modules).resources/views-modules)..json/.php lang files from custom paths.app/Channels/CustomChannel.php).spatie/laravel-package-tools) may need config adjustments.exclude option to blacklist third-party directories.config/auto-reg.php conditions).config/app.php and directory structure.composer require code-distortion/laravel-auto-reg
php artisan vendor:publish --provider="CodeDistortion\AutoReg\AutoRegServiceProvider"
config/auto-reg.php with custom paths (e.g., providers => ['app/Modules/*/Providers/*Provider.php']).php artisan auto-reg:discover --dry-run.php artisan package:discover output before/after.php artisan route:list, php artisan config:clear, etc., to verify.AutoReg warnings/errors.config/app.php during refactoring.config/auto-reg.php, making them easier to audit.auto-reg.php.config/auto-reg.php (e.g., with spatie/laravel-config-array-validation).php artisan auto-reg:discover --verbose # Show discovered files
How can I help you explore Laravel packages today?