I did the same, but I donβt remember very well how I managed to get it to work. I canβt try it right now. Of course you should extend the ControllerCollection :
class MyControllerCollection extends ControllerCollection { public function options($pattern, $to) { return $this->match($pattern, $to)->method('OPTIONS'); } }
And then use it in your regular Application class:
class MyApplication extends Application { public function __construct() { parent::__construct(); $app = $this; $this['controllers_factory'] = function () use ($app) { return new MyControllerCollection($app['route_factory']); }; } public function options($pattern, $to) { return $this['controllers']->options($pattern, $to); } }
source share