-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP Methods
Joshua Parker edited this page Aug 21, 2020
·
2 revisions
Sometimes you might need to create a route that accepts multiple HTTP verbs. For this you can use the map
method. However, If you need to match all HTTP verbs, you can use the any
method.
$router->map(['GET', 'POST'], '/', function() {
// ...
});
$router->any('test', function() {
// ...
});
In most typical cases, you will only need to use one HTTP verb. The following can be used in those cases:
$router->get('test/route', function () {});
$router->head('test/route', function () {});
$router->post('test/route', function () {});
$router->put('test/route', function () {});
$router->patch('test/route', function () {});
$router->delete('test/route', function () {});
$router->options('test/route', function () {});
$router->trace('test/route', function () {});
$router->connect('test/route', function () {});
$router->any('test/route', function () {});