EXC uses messages to decouple the logic of an application. The execution of your application is in essence your code responding to messages.Suggested readings: controllers
appController
is the main controller responsible for the life-cycle of your application and in EXC most messages are generated by the appController
.onAppStart
is considered a handler for the message "AppStart"
.<?php class recordController extends \exc\controller\viewController { public function onAppStart(){ //my code here... } }We use the prefix "on" to identify functions as message handlers that EXC will automatically register as a callback. These automatic message handlers in your controller class are used when your controller class is loaded on request or explicitly by the user when calling
\exc\app::registerController($className, $classInstance)
.<?php $app = \exc\controller\appController::instance(); //get an instance of the app controller $app->on( 'appStart', $callback ); //register for the event appStart
appController
.Name | Type | Description |
---|---|---|
appInit | publish | Your application is about to run. Initialize things required for your app to run. Arguments: None. |
appEnd | event | The backend finished a request and the app instance will be terminated. Arguments: None. |
appAbort | event | The backend is aborting a request and the app instance will be terminated. Arguments: None. |
appClientReady | event | The $client was initialized and is ready for interactions. Arguments: $client . |
appClientCommit | event | The backend is about to send any $client interactions and the app's state to the front-end. Arguments: None. |
appSendHeaders | event | The backend is sending the HTTP headers. Arguments: None. |
appSendOutput | event | The backend is about to send output to the front-end. Usually HTML. Arguments: None. |
appSendJSON | event | The backend is sending a JSON payload. Arguments: None. |
appSendJS | event | The backend is sending a JS payload. Arguments: None. |
viewCommit | event | About to send the default view to the output buffer. Arguments: $view . |
sessionInit | event | A new session store was created. Arguments: None. |