Cấu trúc dự án DLight
Cấu trúc mặc định trong repo hiện tại:
DLight/
├─ app/ # code ứng dụng (MVC, routes, middleware, command)
│ ├─ Controller/ # controllers (App\Controller\*)
│ ├─ Model/ # models (App\Model\*)
│ ├─ Middleware/ # middleware app-level
│ ├─ Router/ # khai báo routes web/api/command
│ ├─ Command/ # lệnh CLI mẫu
│ └─ database/ # dữ liệu demo (json/sqlite)
├─ src/ # core framework (DLight\*)
├─ config/ # cấu hình (app, route, database, view, mail...)
├─ resource/
│ ├─ view/ # view templates (php/twig/bladeone...)
│ └─ js/ # tài nguyên frontend demo (nếu có)
├─ public/ # document root (index.php, .htaccess, static files)
├─ docs/ # tài liệu framework (static)
├─ dli # CLI bootstrapper (php dli ...)
└─ composer.json # dependencies + autoload
Entry point (Web)
- File:
public/index.php - Làm gì: define
ROOT_DIR/INDEX_DIR, load autoload, setup report, nạp routes vàbootWeb().
Routes
- Web routes:
app/Router/web/*.php(ví dụ:web.php,dcloud.php...) - API routes:
app/Router/api/*.php(ví dụ:api.php) - CLI routes:
app/Router/command/command.php(được boot bởidli)
Views
- Thư mục:
resource/view/ - Cấu hình:
config/view.php(chọn engine + options)
Core framework
- Namespace:
DLight\map tớisrc/(theocomposer.json) - App namespace:
App\map tớiapp/