Nibiru docs v0.9.2

Project structure

Where Nibiru puts things, and why. The shape on disk maps to the four MMVC roles — read top-down and the framework will explain itself.

Stable · v0.9.2 Updated 2 days ago Reading time ~ 6 min Edit on GitHub

A fresh Nibiru install is just a Composer-managed PHP project with a single CLI binary, an application/ tree for your code, and a core/ tree for the framework itself. Everything else — Smarty's compiled templates, the public docroot, the migrations history — falls out of those four conventions.

Overview

Open the repo and you'll see this:

tree.txt
# A Nibiru project, top level
my-app/
├── application/        // your code lives here
│   ├── controller/
│   ├── module/
│   ├── view/
│   └── settings/
├── core/               // the framework — don't edit
├── public/             // docroot — point your vhost here
├── nibiru              // the CLI binary
├── composer.json
└── index.php           // front controller

application/

Your code. Each role in MMVC is its own subdirectory: controller/, module/, view/. The fourth — Models — live inside their own module/<name>/models/ subtrees, because in MMVC every module owns the data shape it touches.

Tip

Run ./nibiru -c products and the CLI will scaffold the controller, the module, the navigation entry and a Smarty template into the right places automatically.

core/

The framework itself. Don't edit it. If you find yourself reaching in here, the answer is almost always to extend a class in application/ instead. The single exception: contributing back.

public/

Your vhost docroot. Static assets are served directly from this directory; everything else falls through to the front controller via index.php. The .htaccess in the project root takes care of rewrites for Apache; the included vhost.conf shows the equivalent for nginx.

Naming conventions

Every controller is <name>Controller.php, every module sits at application/module/<name>/, every Smarty template lives at application/view/templates/<name>.tpl. The CLI enforces this — you don't have to remember it.

Path Created by Owns
application/controller/ ./nibiru -c <name> Routing, dispatch, lifecycle
application/module/ ./nibiru -m <name> Capabilities, plugins, models
application/view/templates/ scaffolded with controller Smarty 3 templates
application/settings/migrations/ ./nibiru -mi-add <n> Timestamped SQL migrations
Note

Smarty templates compile to application/view/templates_c/ at first request. That directory is gitignored — clear it with ./nibiru -cache-clear if a template ever sticks.

Next

You know where things go. Now wire one up — the Quick start takes you from an empty project to a running controller in five commands.