From e9d8e9742915c14adc1b974fffa17d9b41090fdc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 19 Jan 2017 12:31:21 +0100 Subject: [PATCH] Document sugar for standard http request methods --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index dc3a001..91bd466 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,22 @@ The `$handler` parameter does not necessarily have to be a callback, it could al class name or any other kind of data you wish to associate with the route. FastRoute only tells you which handler corresponds to your URI, how you interpret it is up to you. +#### Shorcut methods for common request methods + +For the `GET`, `POST`, `PUT`, `PATCH`, `DELETE` and `HEAD` request methods shortcut methods are available. For example: + +```php +$r->get('/get-route', 'get_handler'); +$r->post('/post-route', 'post_handler'); +``` + +Is equivalent to: + +```php +$r->addRoute('GET', '/get-route', 'get_handler'); +$r->addRoute('POST', '/post-route', 'post_handler'); +``` + #### Route Groups Additionally, you can specify routes inside of a group. All routes defined inside a group will have a common prefix.