Skip to content

Conversation

@dbuhonov
Copy link

This PR proposes a new attribute #[Route] to document HTTP endpoints associated with classes and methods.

  • Framework-agnostic: purely informational, does not enforce routing.
  • Improves:
  • Discoverability of endpoints in large codebases
  • IDE navigation and code hints
  • Static analysis and automated API documentation generation

Example:

#[Route('POST', '/resource/create')]
class ResourceCreateAction
{
    public function handle(): void
    {
        // logic
    }
}

#[Route(['PUT', 'PATCH'], '/resource/{id}/update')]
class ResourceUpdateAction
{
    public function handle(): void
    {
        // logic
    }
}

References:

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.

1 participant