Add first-class special route token support for framework-owned URL segments such as @lang and @version
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc src/Router/PatternCompiler.php và src/Router/RouteBuilder.php, sau đó lần theo cách src/Router/Route.php, MatchedRoute.php, RouteDispatcher.php và src/Http/Traits/Request/Route.php biên dịch, khớp và cung cấp các giá trị route. Hoàn tất có nghĩa là các token dành riêng như @version/@lang có thể cùng tồn tại trong một pattern, đến được route context mà không cần default action binding, và giữ nguyên các tham số thông thường, với các bài kiểm thử bao quát việc parsing, matching và hành vi của context.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 36
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quantum-php/framework
-
routing testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/framework#547 ·
-
view
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
quantum-php/framework#542 ·
-
enhancement http
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
quantum-php/framework#565 · 1 bình luận ·
-
components view
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module Đang mởrouting
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
quantum-php/framework#550 ·
Tất cả issue của quantum-php/framework
Issue tương tự
-
tooling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug customer-reported
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Automattic/static-site-importer#1829 ·