Skip to content

Commit f4ce26a

Browse files
authored
Merge pull request #6391 from kenjis/docs-routing
docs: add about route priority
2 parents c7e9e5d + a978af8 commit f4ce26a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

user_guide_src/source/incoming/routing.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,17 @@ be used when the first parameter is a language string:
445445

446446
.. _routing-priority:
447447

448-
Route processing queue
449-
----------------------
448+
Route Priority
449+
**************
450+
451+
Routes are registered in the routing table in the order in which they are defined. This means that when a URI is accessed, the first matching route will be executed.
452+
453+
.. note:: If a route (the URI path) is defined more than once with different handlers, only the first defined route is registered.
454+
455+
You can check registered routes in the routing table by running the :ref:`spark routes <spark-routes>` command.
456+
457+
Changing Route Priority
458+
=======================
450459

451460
When working with modules, it can be a problem if the routes in the application contain wildcards.
452461
Then the module routes will not be processed correctly.
@@ -528,7 +537,7 @@ a valid class/method pair, just like you would show in any route, or a Closure:
528537
will be returned. See :php:func:`Response::setStatusCode() <setStatusCode>` for
529538
information on how to set the status code.
530539

531-
Route processing by priority
540+
Route Processing by Priority
532541
============================
533542

534543
Enables or disables processing of the routes queue by priority. Lowering the priority is defined in the route option.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
// First you need to enable sorting.
3+
// First you need to enable processing of the routes queue by priority.
44
$routes->setPrioritize();
55

66
// Config\Routes
@@ -9,4 +9,4 @@
99
// Modules\Acme\Config\Routes
1010
$routes->get('admin', 'Admin::index');
1111

12-
// The "admin" route will now be processed before the wildcard router.
12+
// The "admin" route will now be processed before the wildcard route.

0 commit comments

Comments
 (0)