starting 1.9.0 beta with ability to set custom routes in onBeforeRender or as properties of Controller class definitions
starting 1.9.0 beta with ability to set custom routes in onBeforeRender or as properties of Controller class definitions

You define the HTTP methods that handle the route, followed by a regex that can include place holders for ":somevar" variables which are passed to a callable.

If the callable it just a string it will search within the existing controller for a method matching that name.  e.g.  '/some-animal' => 'someAnimal' would call the controllers someAnimal method if it existed

You can also use full name for callable like '\Controllers\Dance::run'

If you define the routes in the onBeforeRender you can also use closures which can reference $this.
//can be defined as controller property 

public $routes = [
           'GET,POST,DANCE' => [
               '/狼/:name/:id$' => 'wolf',
               '/dance/run' => '\Controllers\Dance::run',
               '/some-scheduled-thing' => 'scheduledThing'
           ]
       ];

or in the onBeforeRender.
$this->routes = [
           'GET,POST,DANCE' => [
               '/狼/:name/:id$' => 'wolf',
               '/dance/run' => '\Controllers\Dance::run',
               '/some-scheduled-thing' => 'scheduledThing',
               '/some-closure/:name/:id' => function($name, $id){
                    print_r($this);
               }
           ]
       ];
surebert/surebert-framework