routes/ + controllers/ — 라라벨 스타일 라우팅
v6.2.0 에서 추가된 라라벨 스타일 확장 레이어입니다. 기존 파일 기반 Dispatcher 와 공존하며, routes/ 에 등록된 라우트가 있으면 우선 처리됩니다.
routes/
├── README.md ← 사용법 가이드
└── web.php ← (개발자가 생성) 라우트 정의 파일 — 자동 로드됨
controllers/
├── README.md ← 컨트롤러 작성 예제 가이드
└── *.php ← (개발자가 생성) 컨트롤러 클래스 파일 — 자동 탐색됨
routes/web.php 작성 예시
<?php
// GET 라우트 + 미들웨어
DxRouter::get('/dashboard', 'DashboardController@index')
->middleware('auth');
// 그룹 (prefix + 미들웨어 일괄 적용)
DxRouter::group(array('prefix'=>'/shop','middleware'=>'auth'), function() {
DxRouter::get('/cart', 'ShopController@cart');
DxRouter::post('/order', 'ShopController@order')->middleware('csrf');
});
// REST 리소스 자동 등록 (index/show/store/update/destroy)
DxRouter::resource('/api/posts', 'PostApiController');
// 클로저 라우트
DxRouter::get('/health', function() {
echo json_encode(array('status'=>'ok','version'=>DX_VERSION));
exit;
});
controllers/ 컨트롤러 자동 탐색 경로
DxContainer::call('ClassName@method') 호출 시 다음 순서로 파일을 탐색합니다.
▸ 1순위: controllers/{ClassName}.php
▸ 2순위: controllers/{classname}.php (소문자 변환)
▸ 3순위: core/controllers/{ClassName}.php
▸ 4순위: plugins/*/controllers/{ClassName}.php (플러그인 컨트롤러)