プロジェクト構造
Nibiruプロジェクトの各ディレクトリをガイドするツアー。
my-app/├── core/ # Framework code (don't edit)│ ├── a/ # Abstract classes + adapters│ ├── c/ # Concrete classes (router, view, form types…)│ ├── f/ # Factories (db, form)│ ├── i/ # Interfaces│ ├── l/ # Composer vendor (yes, in core/)│ ├── t/ # Traits│ └── framework.php # Main bootstrap├── application/ # Your app│ ├── controller/ # *Controller.php files│ ├── model/ # Auto-generated models (from DB schema)│ ├── module/ # Modules (the second M in MMVC)│ │ └── users/ # each with its own MVC + plugins│ ├── settings/│ │ └── config/│ │ ├── settings.<env>.ini│ │ ├── database/ # numbered SQL migration files│ │ └── navigation/main.json│ └── view/│ ├── templates/ # Smarty .tpl files│ ├── templates_c/ # Smarty compile cache (auto)│ ├── cache/ # HTML cache (when caching=true)│ └── mockup/ # Static design mockups├── public/ # CSS / JS / images / fonts (web-served)├── nibiru # CLI binary├── index.php # Entry point├── composer.json└── vhost.conf # Sample nginx vhostコントローラー
Section titled “コントローラー”- ファイル:
application/controller/<name>Controller.php - クラス:
Nibiru\<name>Controller extends Nibiru\Adapter\Controller - 必要なメソッド:
pageAction(),navigationAction()。オプション: 任意の<verb>Action()。
- ファイル:
application/view/templates/<name>.tplは対応するコントローラー用です。 - サブビューは
application/view/templates/<name>/<action>.tplの下に置きます。 - 共通の部分テンプレートは
application/view/templates/shared/にあります。
application/model/以下で自動生成されます。- ファイル名はテーブル名に一致します。各クラスは
Dbアダプター(MySQL\DbまたはPostgreSQL\Db)を拡張しています。
- フォルダ:
application/module/<name>/ - 各モジュールは、トレイト、プラグイン、インターフェース、および設定を含む独自のMVC島です。
- レジストリは各モジュールの
settings/内にある*.ini設定を自動的に検出します。
マイグレーション
Section titled “マイグレーション”application/settings/config/database/<NNN>-<slug>.sql- 番号付けされています。
./nibiru -mi <env>で実行します。 - 論理的な変更ごとに1つのファイル — 統合しないでください。
Composer vendor in core/l/
Section titled “Composer vendor in core/l/”これは意図的なものです。composer.json は vendor-dir: core/l を設定しています。フレームワークのオートローダーは、そこに期待しています。移動しないでください。
templates_c/ と cache/
Section titled “templates_c/ と cache/”Smarty は templates_c/ に書き込む必要があります。キャッシュは INI キー [ENGINE] caching = true を通じてオプトインできます。両方のフォルダは .gitignore に記載してください。