Document variable path segment routes#471
Open
samdark wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the routing guide with examples for variable-depth URL paths, covering both bounded optional route segments and catch-all regex parameters.
Changes:
- Adds a new routing subsection for variable numbers of path segments.
- Documents nested optional parts for predictable matching and URL generation.
- Explains catch-all regex route behavior and
%2Fencoding during URL generation.
|
|
||
| Optional parts are only supported in a trailing position, not in the middle of a route. | ||
|
|
||
| ### Variable number of path segments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
%2F, so optional parts are better for generated hierarchical URLsVerification
yiisoft/apptemplate created withcomposer create-project yiisoft/app /tmp/yii-docs-upload-app --no-interactionverify-variable-url-parameters.phpto exercise Yii Router matching and URL generationphp -l verify-variable-url-parameters.phpphp verify-variable-url-parameters.php; verified:/docs/docs/guide/docs/guide/routing/files/2026%2Freport.pdfpath => 2026/report.pdfvendor/bin/phpstan analyse verify-variable-url-parameters.php --level=max --no-progressvendor/bin/psalm --no-cache --output-format=console verify-variable-url-parameters.phpnpx markdown-link-check src/guide/runtime/routing.mdnpm run build