Skip to content

Commit 64370c4

Browse files
committed
docs: add sections
1 parent c399d66 commit 64370c4

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

user_guide_src/source/incoming/routing.rst

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ You can supply multiple verbs that a route should match by passing them in as an
7979

8080
.. literalinclude:: routing/004.php
8181

82+
Specifying Route Handlers
83+
=========================
84+
8285
Controller's Namespace
83-
======================
86+
----------------------
8487

8588
If a controller name is stated without beginning with ``\``, the :ref:`routing-default-namespace` will be prepended:
8689

@@ -97,7 +100,7 @@ You can also specify the namespace with the ``namespace`` option:
97100
See :ref:`assigning-namespace` for details.
98101

99102
Array Callable Syntax
100-
=====================
103+
---------------------
101104

102105
.. versionadded:: 4.2.0
103106

@@ -122,8 +125,20 @@ In such a case, you can specify the parameters manually:
122125
.. literalinclude:: routing/016.php
123126
:lines: 2-
124127

128+
Using Closures
129+
--------------
130+
131+
You can use an anonymous function, or Closure, as the destination that a route maps to. This function will be
132+
executed when the user visits that URI. This is handy for quickly executing small tasks, or even just showing
133+
a simple view:
134+
135+
.. literalinclude:: routing/020.php
136+
137+
Specifying Route Paths
138+
======================
139+
125140
Placeholders
126-
============
141+
------------
127142

128143
A typical route might look something like this:
129144

@@ -174,7 +189,7 @@ routes. With the examples URLs from above:
174189
will only match **product/123** and generate 404 errors for other example.
175190

176191
Custom Placeholders
177-
===================
192+
-------------------
178193

179194
You can create your own placeholders that can be used in your routes file to fully customize the experience
180195
and readability.
@@ -186,7 +201,7 @@ This must be called before you add the route:
186201
.. literalinclude:: routing/017.php
187202

188203
Regular Expressions
189-
===================
204+
-------------------
190205

191206
If you prefer you can use regular expressions to define your routing rules. Any valid regular expression
192207
is allowed, as are back-references.
@@ -212,15 +227,6 @@ For those of you who don't know regular expressions and want to learn more about
212227

213228
.. note:: You can also mix and match placeholders with regular expressions.
214229

215-
Using Closures
216-
==============
217-
218-
You can use an anonymous function, or Closure, as the destination that a route maps to. This function will be
219-
executed when the user visits that URI. This is handy for quickly executing small tasks, or even just showing
220-
a simple view:
221-
222-
.. literalinclude:: routing/020.php
223-
224230
.. _view-routes:
225231

226232
View Routes

0 commit comments

Comments
 (0)