diff options
| author | Brett Parson <brett@brett-parson.com> | 2026-08-21 13:55:37 -0500 |
|---|---|---|
| committer | Brett Parson <brett@brett-parson.com> | 2026-08-21 14:00:11 -0500 |
| commit | d039a5d62a9ac6ababae70d9d96422ca59f2b2d4 (patch) | |
| tree | f0db4750a571e8040a5da02cc7190079c0d62914 /docs/adr/0002-attribute-based-route-declaration.md | |
| parent | 0de77a6334cee1f6e15f7e0fd35602514560be33 (diff) | |
| download | miniroute-d039a5d62a9ac6ababae70d9d96422ca59f2b2d4.tar.gz miniroute-d039a5d62a9ac6ababae70d9d96422ca59f2b2d4.zip | |
Scaffold miniroute routing/middleware kernel
Diffstat (limited to 'docs/adr/0002-attribute-based-route-declaration.md')
| -rw-r--r-- | docs/adr/0002-attribute-based-route-declaration.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/adr/0002-attribute-based-route-declaration.md b/docs/adr/0002-attribute-based-route-declaration.md new file mode 100644 index 0000000..d1d4c79 --- /dev/null +++ b/docs/adr/0002-attribute-based-route-declaration.md @@ -0,0 +1,24 @@ +# ADR 0002: Attribute-Based Route Declaration + +- Status: Accepted +- Date: 2026-08-17 + +## Context + +Routes need a home that does not grow linearly in a central composition root. + +## Decision + +Routes are declared with method-specific PHP attributes (`Get`, `Post`, `Put`, +`Patch`, `Delete`) on controller methods. A reflection-based `RouteLoader` +compiles them into `RouteDef` objects. `Middleware` is a repeatable attribute +valid on classes and methods. + +Matching precedence is deterministic: literal segments sort before +`{parameter}` segments, so registration order is irrelevant. + +## Consequences + +- Adding a route touches only the controller. +- The loader must be covered by tests (reflection is where mistakes hide). +- Precedence is explicit rather than dependent on registration order. |
