Skip to content

Commit

Permalink
docs: add user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 23, 2022
1 parent 7325e49 commit e7230dc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ You can supply multiple verbs that a route should match by passing them in as an
.. literalinclude:: routing/004.php
:lines: 2-

Array Callable Syntax
=====================

Since v4.2.0, you can use array callable syntax to specify the controller:

.. literalinclude:: routing/004_1.php
:lines: 2-

Or using ``use`` keyword:

.. literalinclude:: routing/004_2.php
:lines: 2-

When you specify parameters:

.. literalinclude:: routing/004_3.php
:lines: 2-

Placeholders
============

Expand Down
3 changes: 3 additions & 0 deletions user_guide_src/source/incoming/routing/004_1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$routes->get('/', [\App\Controllers\Home::class, 'index']);
5 changes: 5 additions & 0 deletions user_guide_src/source/incoming/routing/004_2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

use App\Controllers\Home;

$routes->get('/', [Home::class, 'index']);
5 changes: 5 additions & 0 deletions user_guide_src/source/incoming/routing/004_3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

use App\Controllers\Product;

$routes->add('product/(:num)/(:num)', [[Product::class, 'index'], '$1/$2']);

0 comments on commit e7230dc

Please sign in to comment.