Skip to content

Controller Registration Improvement#205

Merged
techmahedy merged 1 commit intodoppar:3.xfrom
techmahedy:techmahedy-3.x
Mar 4, 2026
Merged

Controller Registration Improvement#205
techmahedy merged 1 commit intodoppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Member

Controllers can now be discovered from both your app and module directories, not modules, actually, from any place

finance/
├── app/
│   └── Http/
│       └── Controllers/
│           └── HomeController.php      ✅ INCLUDED (your app)
├── modules/
│   └── Blog/
│       └── Controllers/
│           └── PostController.php      ✅ INCLUDED (your modules)
└── app/
    └── Services/
        └── TestController.phpINCLUDED (if there is #[Route] attribute)

A class is now considered a controller if it satisfies any of the following conditions:

  1. Its name ends with Controller.
  2. It has at least one public method with the #[Route] attribute.
  3. It extends the base \App\Http\Controllers\Controller class.

This improves controller discovery to include both app and module controllers while maintaining convention and attribute support.

Impact:

  1. Improves automatic controller discovery for both app and module code.
  2. Supports attribute-based routing and standard naming conventions.
  3. Ensures modules integrate seamlessly without hardcoded registration.

@techmahedy techmahedy merged commit 33554ad into doppar:3.x Mar 4, 2026
27 checks passed
@rrr63
Copy link
Member

rrr63 commented Mar 4, 2026

love it, good job @techmahedy

@techmahedy
Copy link
Member Author

@rrr63 thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants