Add first-class special route token support for framework-owned URL segments such as @lang and @version
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia leggendo src/Router/PatternCompiler.php e src/Router/RouteBuilder.php, poi segui il modo in cui src/Router/Route.php, MatchedRoute.php, RouteDispatcher.php e src/Http/Traits/Request/Route.php compilano, confrontano ed espongono i valori delle route. Il lavoro è completo quando i token riservati come @version/@lang possono coesistere in un unico pattern, raggiungere il contesto della route senza binding dell’azione predefinita e lasciare invariati i parametri ordinari, con test che coprano parsing, matching e comportamento del contesto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add first-class router support for framework-owned special route tokens such as:
@lang@version
so route definitions can explicitly declare special URL segments in a clear, semantic, and framework-native way.
Why
Quantum currently handles special routing concerns inconsistently.
For example:
- language URL handling relies on config-driven segment position detection
- API versioning has no clean framework-level model yet
This makes special URL segments feel implicit, positional, and harder to reason about than ordinary route structure.
A better model is to let routes explicitly declare framework-owned special segments in the route pattern itself.
Examples:
$route->get('@lang/posts', 'PostController', 'posts');
$route->get('@version/posts', 'PostController', 'posts');
$route->get('@version/@lang/posts', 'PostController', 'posts');
This makes route semantics explicit while allowing the framework to treat those segments differently from ordinary user-defined route parameters.
Goal
Introduce a routing foundation that supports reserved special route tokens for framework-level concerns.
This foundation should make it possible for Quantum to support explicit special URL segments without relying on brittle positional config or ad hoc route conventions.
Proposed Direction
Support reserved route tokens inside route patterns, beginning with the concept of framework-owned segments such as:
@lang@version
These tokens should be recognized by the router as special routing constructs rather than ordinary route parameters.
The framework should be able to:
- recognize these tokens during route compilation
- match them correctly during request routing
- attach their resolved values to framework route context
- keep them distinct from normal action parameters unless explicitly intended otherwise
Important behavior
Special route tokens should be treated differently from ordinary route params.
They should be:
- framework-reserved
- semantically meaningful
- available to framework internals such as language detection or version-aware controller resolution
- prevented from behaving like ordinary positional controller action arguments by default
Initial scope
This ticket is the router foundation only.
It should establish the special-token mechanism itself, not fully implement every feature that may use it.
Follow-up features can then build on this foundation, including:
- explicit
@langrouting support - explicit
@versionAPI routing support
Acceptance Criteria
- the router supports reserved special tokens inside route patterns
- special tokens are recognized during route compilation and matching
- matched special-token values are available to framework internals as route context
- special-token values are kept distinct from ordinary controller action parameter binding by default
- the routing system can support multiple special tokens in one path, such as
@version/@lang/posts - tests cover special-token parsing, matching, and route context behavior
- existing ordinary route parameter behavior remains intact
Notes
Relevant code:
src/Router/PatternCompiler.phpsrc/Router/RouteBuilder.phpsrc/Router/Route.phpsrc/Router/MatchedRoute.phpsrc/Router/RouteDispatcher.phpsrc/Http/Traits/Request/Route.php
This ticket should be treated as the routing foundation for future explicit @lang and @version support.
- Lingua principale
- PHP
- Stelle
- 36
- Fork
- 22
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quantum-php/framework
-
routing testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
quantum-php/framework#547 ·
-
view
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
quantum-php/framework#542 ·
-
enhancement http
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
quantum-php/framework#565 · 1 commento ·
-
components view
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module Apertarouting
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
quantum-php/framework#550 ·
Tutte le issue di quantum-php/framework
Issue simili
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
-
Перевод устарел
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
-
[6.x]: "Cannot use object of type stdClass as array" loading Users index (regression of #19182) Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100