Creating sample backend module
In Aurora, application is presented as a set of modules. However, it's perfectly acceptable to have some kind of backend module which isn't a part of any application yet it implements some relatively minor functionality aspect.
As an example, let's create a module which logs activity of the users. The module will only have backend code. We'll create modules/Logger directory and put two files in there.
Primary file of any backend module is module.php. In our module, it will contain the following code:
class Module extends \Aurora\System\Module\AbstractModule
public function init()
$iUserId = \CApi::getAuthenticatedUserId();
\CApi::LogOnly('['.date('d.m.Y h:i:s A').'] User ID: '.$iUserId, 'user_activity_log.txt');
This code is invoked on any request to server performed for an authenticated user, and it adds an entry to
One more file we're placing is config.json:
This file isn't used in earlier versions of Aurora framework. In newer ones, starting from framework version 0.4.0, it's required to provide a way of disabling a module individually.
Now that we have all the files of our module in place, we need to let Aurora know about this new module. That's done by rebuilding static files as explained here.