diff --git a/docs/003.Redirect.md b/docs/003.Redirect.md new file mode 100644 index 0000000..9ee4efe --- /dev/null +++ b/docs/003.Redirect.md @@ -0,0 +1,33 @@ +Redirect +======== + +The plugin allows redirect to specified route or url. It returns the instance +of `Psr\Http\Message\ResponseInterface`: +``` +use Es\ControllerPlugins\PluginsTrait; + +class ExampleController +{ + use PluginsTrait; + + public function indexAction() + { + // ... + return $this->redirect()->toUrl('http://google.com'); + } +} +``` +``` +use Es\ControllerPlugins\PluginsTrait; + +class ExampleController +{ + use PluginsTrait; + + public function indexAction() + { + // ... + return $this->redirect()->toRoute('foo', ['bar' => 'baz']); + } +} +```