From eaa9c99dd711ca5c4fd077a2e193b06625f6d87f Mon Sep 17 00:00:00 2001 From: Yuriy Tkachenko Date: Thu, 10 Mar 2016 09:52:18 +0300 Subject: [PATCH] Updated README.md Added example for routing object methods --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84c6290..3876db1 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,24 @@ class Greeting { } } -Flight::route('/', array('Greeting','hello')); +Flight::route('/', array('Greeting', 'hello')); +``` + +Or an object method: + +```php +class Greeting +{ + public function __construct() { + $this->name = 'John Doe'; + } + + public function hello() { + echo "Hello, {$this->name}!"; + } +} + +Flight::route('/', array(new Greeting, 'hello')); ``` Routes are matched in the order they are defined. The first route to match a