Scaffolding Modules & Controllers
Generate controllers, modules, and plugins with the CLI.
Controllers
Section titled “Controllers”./nibiru -c productsCreates two files:
application/controller/productsController.phpapplication/view/templates/products.tplThe controller stub:
<?phpnamespace Nibiru;use Nibiru\Adapter\Controller;
class productsController extends Controller{ public function pageAction() { View::assign(['title' => 'Products']); }
public function navigationAction() { JsonNavigation::getInstance()->loadJsonNavigationArray(); }}The template stub:
{include 'shared/header.tpl'}<body>{include file="navigation.tpl"}<main class="container"> <h1>{$title}</h1></main>{include 'shared/footer.tpl'}</body>Controllers are PHP files only — no JS or CSS scaffold, so you stay in control of asset wiring.
Modules
Section titled “Modules”./nibiru -m billingCreates:
application/module/billing/├── billing.php├── interfaces/billing.php├── plugins/├── settings/billing.ini└── traits/The main class implements IModule and exposes a constructor that loads the module’s registry config. Add the -g flag to include Graylog observer wiring out of the box:
./nibiru -m billing -gWhen -g is set the scaffold imports a Graylog observer, attaches it in the constructor, and emits notify() on key state changes — so any GELF-capable Graylog server picks up module events with no extra plumbing.
Plugins
Section titled “Plugins”A plugin lives inside a module:
./nibiru -p invoices -m billingCreates application/module/billing/plugins/invoices.php:
<?phpnamespace Nibiru\Module\Billing\Plugin;use Nibiru\Module\Billing\Billing;
class Invoices extends Billing{ public function listOpen(): array { return \Nibiru\Pdo::fetchAll( 'SELECT * FROM invoices WHERE status = :s ORDER BY due_date', [':s' => 'open'] ); }}Plugins inherit from the module so they share its registry, settings, and observer machinery.
Bootstrap (-s)
Section titled “Bootstrap (-s)”./nibiru -s runs after install (or after pulling a fresh checkout) to:
- Create
application/view/templates_c/andapplication/view/cache/if missing. - Fix permissions (writable by the web server user) on those folders.
- Verify required PHP extensions are loaded.
- Verify the database driver in your INI is supported by this binary build.
It’s safe to run repeatedly.
Cache clear (-cache-clear)
Section titled “Cache clear (-cache-clear)”Wipes both the Smarty compile cache and the rendered HTML cache:
./nibiru -cache-clearRun after a deploy when:
- You changed
.tplfiles, - You changed
[ENGINE] cachingsettings, - You modified Smarty plugins.
The cache regenerates on the next request.