The configuration file allows you to enable/disable automatic registration, define which directories to scan for attributes, and apply group settings (like middleware or prefixes) to specific directories.
Key configuration options:
enabled: Boolean to turn automatic registration on or off.directories: An array of directories to scan. You can provide a simple path string or an associative array to apply group configuration to that path.patterns: An array of glob patterns to include specific files (e.g., *Controller.php).not_patterns: An array of glob patterns to exclude specific files (e.g., *Test.php).
For directories outside the application root, use a namespace => path pattern or a path => ['namespace' => '...'] pattern.
return [
'enabled' => true,
'directories' => [
app_path('Http/Controllers'),
// Apply group configuration to a directory
app_path('Http/Controllers/Web') => [
'middleware' => ['web']
],
// Using namespace/path mapping for external modules
'Modules\Admin\Http\Controllers\' => base_path('admin-module/Http/Controllers'),
// Using patterns to filter files
base_path('app-modules/Blog') => [
'patterns' => ['*Controller.php'],
'not_patterns' => ['*Test.php'],
],
],
];