Class Controller
Base web controller class for convenience and accessibility to newcomers.
Although this class is named "Controller", this does not mean that only classes that extend this class can be mapped to a route in the framework. Any plain PHP class with a method that returns a string or a Response object can be used as a controller. This class is simply a convenience class, with a lot of common utility methods already implemented, like dealing with the session, rendering templates, returning various responses, and more.
If you are unable to extend the controller class for any reason, you can just use the trait instead:
class MyController extends SomethingElse { use \Autarky\Routing\ControllerTrait; }
- Autarky\Routing\Controller implements Autarky\Container\ContainerAwareInterface uses Autarky\Routing\ControllerTrait
setContainer()
|
dispatchEvent(),
flash(),
flashInput(),
flashMessages(),
getEventDispatcher(),
getLogger(),
getOldInput(),
getSession(),
json(),
log(),
redirect(),
render(),
response(),
url()
|
setContainer()
|